Ripemd 160
Ripemd 160
Ripemd 160
1 Introduction
RIPEMD-160 is a fast cryptographic hash function that is tuned towards soft-
ware implementations on 32-bit architectures. It has evolved from the 256-bit
extension of MD4, which was introduced in 1990 by Ron Rivest [20, 21]. Its main
design feature are two different and independent parallel chains, the result of
which are combined at the end of every application of the compression function.
As suggested by its name, RIPEMD-160 offers a 160-bit result. It is intended
to provide a high security level for the next 10 years or more. RIPEMD-128
is a faster variant of RIPEMD-160, which provides a 128-bit result. Together
with SHA-1, RIPEMD-160 and RIPEMD-128 have been included in the Inter-
national Standard ISO/IEC 10118-3, the publication of which is expected for
late 1997 [17]. The goal of this article is to motivate the existence of RIPEMD-
160, to explain the main design features and to provide a concise description of
the algorithm.
(Belgium).
collision resistance, i.e., that it should be hard to find two distinct inputs with
the same hash result.
C.W.I. (NL) prime contractor, Århus University (DK), KPN (NL), K.U.Leuven (B), Philips
Crypto B.V. (NL), and Siemens AG (D).
SHA borrows many of its design features from MD4 and MD5, it also has some
remarkable differences in the message processing: instead of reordering message
blocks in the different rounds, they were processed through a linear function,
which at bit level can be described as a shortened cyclic code. Moreover, it has
80 steps compared to 48 for MD4 and 64 for MD5. On July 11, 1994 NIST
announced a revision of FIPS 180, under the name SHA-1, which “corrects a
technical flaw that made the standard less secure than had been thought. The
algorithm is still reliable as a security mechanism, but the correction returns the
SHS to the original level of security” [16]. No further details on the flaw were
made available.
In 1992 Th. Berson tried to cryptanalyze MD5 using differential cryptanaly-
sis [2]. A new cryptanalytic result on MD4 was obtained in 1994 by S. Vaudenay
[24]. One year later, the 2nd author started his successful cryptanalytic work
on the MD4-type hash functions. This resulted in collisions for MD4 [9, 11],
and collisions for the compression function of MD5 [13] and extended MD4 [12].
Moreover, he developed collisions for 2 out of the 3 rounds of RIPEMD [10].
Early 1997 he showed that it is also possible to compute a preimage for 2 rounds
out of 3 for MD4 [14]. The results on RIPEMD were of some concern to the
members of the RIPE consortium, as RIPEMD was designed to withstand the
partial attacks developed by the consortium on MD4 and MD5.
An independent reason to upgrade RIPEMD is the limited resistance against
a brute force collision search attack. P. van Oorschot and M. Wiener demon-
strated in [23] a design for a $10 million collision search machine for MD5 that
could find a collision in 24 days. It is clear that these results extend easily to
any similar hash function with a 128-bit result. Taking into account ‘Moore’s
law’ (the cost of computation and memory is divided by four every three years),
a 128-bit hash-result does not offer sufficient protection for the next ten years.
As a consequence, it was decided to upgrade RIPEMD. RIPEMD-128, with a
128-bit result was designed as a plug-in substitute for RIPEMD, while RIPEMD-
160 was intended to provide long term security (10 years or more) with a 160-
bit result. In addition, it was decided to stay as close as possible to RIPEMD,
in order to capitalize on the evaluation effort for this algorithm. Moreover,
all design criteria and evaluation results should be public. Finally, note that
both designs are rather conservative: RIPEMD-128 has four double rounds, and
RIPEMD-160 has five double rounds, while breaking three double would require
a substantial improvement of existing cryptanalytic techniques. This means that
RIPEMD-160 can provide the long term security required for digital signatures;
we believe that this is worth the small penalty paid in terms of performance.
5 Description of RIPEMD-160
Like all MD4-variants, RIPEMD-160 operates on 32-bit words. Its primitive
operations are:
i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
ρ(i) 7 4 13 1 10 6 15 3 12 0 9 5 2 14 11 8
• the shifts are chosen between 5 and 15 (too small/large shifts are consid-
ered not very good, and a choice larger than 16 does not help much);
• every message block should be rotated over different amounts, not all of
them having the same parity;
• the shifts applied to each register should not have a special pattern (for
example, the total should not be divisible by 32);
Note that the design decisions require a compromise: it is not possible to make
a good choice of message ordering and shift constants for five rounds that is also
‘optimal’ for three rounds out of five.
6 Performance
In this section we compare the performance of RIPEMD-160, RIPEMD-128,
SHA-1, MD5, and MD4. Implementations were written in Assembly language
optimized for the Pentium processor (90 MHz); the optimizations are tuned
to make use of the instruction-level parallelism of this processor. In spite of
their serial design, the algorithms can still make use of this feature. More
implementation details concerning the MD4-family of hash functions can be
found in [3, 5, 6]. The relative speeds coincide more or less with predictions
7 Status of RIPEMD-160
RIPEMD-160 has been put in the public domain by its designers so that anyone
can use it. Portable C source code and test values are available at:
http://www.esat.kuleuven.ac.be/~bosselae/ripemd160.
We invite the reader to explore the security of RIPEMD-160. We envisage
that in the next years it will become possible to attack one of the two lines and
up to three rounds of the two parallel lines, but that the combination of the two
parallel lines will resist attacks.
References
[1] M. Bellare, R. Canetti, H. Krawczyk, “Keying hash functions for mes-
sage authentication,” Advances in Cryptology, Proceedings Crypto’96,
LNCS 1109, N. Koblitz, Ed., Springer-Verlag, 1996, pp. 1–15. Full version:
http:// www.research.ibm.com/security/.
[7] B. den Boer, A. Bosselaers, “An attack on the last two rounds of MD4,”
Advances in Cryptology, Proc. Crypto’91, LNCS 576, J. Feigenbaum, Ed.,
Springer-Verlag, 1992, pp. 194–203.
[14] H. Dobbertin, “The first twp rounds of MD4 are not one-way,” Fast Soft-
ware Encryption, LNCS, Springer-Verlag, 1998, to appear.
[18] B. Preneel, P.C. van Oorschot, “MDx-MAC and building fast MACs
from hash functions,” Advances in Cryptology, Proceedings Crypto’95,
LNCS 963, D. Coppersmith, Ed., Springer-Verlag, 1995, pp. 1–14.
[19] RIPE, “Integrity Primitives for Secure Information Systems. Final Re-
port of RACE Integrity Primitives Evaluation (RIPE-RACE 1040),”
LNCS 1007, Springer-Verlag, 1995.
[20] R.L. Rivest, “The MD4 message digest algorithm,” Advances in Cryptol-
ogy, Proc. Crypto’90, LNCS 537, S. Vanstone, Ed., Springer-Verlag, 1991,
pp. 303–311.
[21] R.L. Rivest, “The MD4 message-digest algorithm,” Request for Comments
(RFC) 1320, Internet Activities Board, Internet Privacy Task Force, April
1992.
[22] R.L. Rivest, “The MD5 message-digest algorithm,” Request for Comments
(RFC) 1321, Internet Activities Board, Internet Privacy Task Force, April
1992.
[23] P.C. van Oorschot, M.J. Wiener, “Parallel collision search with application
to hash functions and discrete logarithms,” Proc. 2nd ACM Conference on
Computer and Communications Security, ACM, 1994, pp. 210–218.
RIPEMD-160: definitions
RIPEMD-160: pseudo-code
for i := 0 to t − 1 {
A := h0 ; B := h1 ; C := h2 ; D = h3 ; E = h4 ;
A0 := h0 ; B 0 := h1 ; C 0 := h2 ; D0 = h3 ; E 0 = h4 ;
for j := 0 to 79 {
T := rols(j) (A f (j, B, C, D) Xi [r(j)] K(j)) E;
A := E; E := D; D := rol10 (C); C := B; B := T ;
T := rols0 (j) (A0 f (79 − j, B 0 , C 0 , D0 ) Xi [r0 (j)] K 0 (j)) E0;
A0 := E 0 ; E 0 := D0 ; D0 := rol10 (C 0 ); C 0 := B 0 ; B 0 := T ;
}
T := h1 C D0 ; h1 := h2 D E 0 ; h2 := h3 E A0 ;
h3 := h4 A B 0 ; h4 := h0 B C 0 ; h0 := T ;
}
h0 h1 h2 h3 h4
q?
q?
q?
q?
q?
????? ?????
Xi - f 1 , K1 f5 , K10 ¾ Xπ(i)
????? ?????
????? ?????
????? ?????
????? ?????
????? ?????
-?¾
-?¾
-? ¾
-?¾
-?¾
?????
h0 h1 h2 h3 h4