Вы находитесь на странице: 1из 10

RIPEMD-160

RIPEMD160 ( . RACE Integrity Primitives Evaluation Message Digest)


-,
. , . . . RIPEMD160
RIPEMD, , ,
MD4 SHA1.
128-, 256- 320- ,
RIPEMD128, RIPEMD256 RIPEMD320. 128-
RIPEMD,
128- . 256- 320-
,
, .
RIPEMD160 ,
SHA1 SHA2, NSA. RIPEMD
160 - .
.
M b , -
. b
, 8. M
: m1 m2 m3 mb2 mb1.
t , 16 32 . 32- ,
, (, (a b c d e f g h)
32- (dcba hgfe)). M [i][j] j- i-
.
'+' 232, ..
a + b (a + b) mod 232. 'X <<< s'
X s .
1 2.
.
1 2 MD5.
3. .
f:

x y z,
x y x z ,

f j , x , y , z x y z ,
x z y z ,

x y z ,

0 j 15,
16 j 31,
32 j 47,
48 j 63,
64 j 79.

16- :
00000000,
5A827999,

K1 j 6ED9EBA1 ,
8F1BBCDC ,

A953FD4E ,

0 j 15,
16 j 31,
32 j 47,
48 j 63,
64 j 79.

50A28BE6 ,
5C4DD124 ,

K 2 j 6D703EF3,
7A6D76E9 ,

00000000,

0 j 15,
16 j 31,
32 j 47,
48 j 63,
64 j 79.

32- :
R1( 0..15) =
R1(16..31) =
R1(32..47) =
R1(48..63) =
R1(64..79) =

0,
7,
3,
1,
4,

1, 2, 3, 4, 5, 6, 7, 8, 9,
4, 13, 1, 10, 6, 15, 3, 12,
10, 14, 4, 9, 15, 8, 1, 2,
9, 11, 10, 0, 8, 12, 4, 13,
0, 5, 9, 7, 12, 2, 10, 14,

10, 11, 12, 13, 14, 15


0, 9, 5, 2, 14, 11, 8
7, 0, 6, 13, 11, 5, 12
3, 7, 15, 14, 5, 6, 2
1, 3, 8, 11, 6, 15, 13

R2( 0..15) =
R2(16..31) =
R2(32..47) =
R2(48..63) =
R2(64..79) =

5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12


6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2
15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13
8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14
12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11

,
:
S1( 0..15) = 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8
S1(16..31) = 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12
S1(32..47) = 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5
S1(48..63) = 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12
S1(64..79) = 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
S2( 0..15) =
S2(16..31) =
S2(32..47) =
S2(48..63) =
S2(64..79) =

8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6


9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11
9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5
15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8
8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11

-:
h0 = 67452301;
h4 = C3D2E1F0;
h8 = 01234567;

h1 = EFCDAB89;
h5 = 76543210;
h9 = 3C2D1E0F;

h2 = 98BADCFE;
h6 = FEDCBA98;

h3 = 10325476;
h7 = 89ABCDEF;

4. .
( i)
512- .
:
For i = 0 to t-1
{
A1 = h0; B1 = h1; C1 = h2; D1 = h3; E1 = h4;
A2 = h0; B2 = h1; C2 = h2; D2 = h3; E2 = h4;
For j = 0 to 79
{
T = (A1 + f(j, B1, C1, D1) + M[i][R1(j)] + K1(j)) <<< S1(j) + E1;
A1 = E1; E1 = D1; D1 = C1 <<< 10; C1 = B1; B1 = T;

T = (A2 + f(79-j, B2, C2, D2) + M[i][R2(j)] + K2(j)) <<< S2(j) + E2;
A2 = E2; E2 = D2; D2 = C2 <<< 10; C2 = B2; B2 = T;
}
T = h1 + C1 + D2; h1 = h2 + D1 + E2; h2 = h3 + E1 + A2;
h3 = h4 + A1 + B2; h4 = h0 + B1 + C2; h0 = T;
}

5. .

:

h0 || h1 || h2 || h3 || h4

- ( 16- ).
RIPEMD160 ("") = 9c1185a5 c5e9fc54 61280897 7ee8f548 b2258d31

RIPEMD128
1, 2 3 RIPEMD
160.
4. .
( i)
512- .
:
For i = 0 to t-1
{
A1 = h0; B1 = h1; C1 = h2; D1 = h3;
A2 = h0; B2 = h1; C2 = h2; D2 = h3;
For j = 0 to 63
{
T = (A1 + f(j, B1, C1, D1) + M[i][R1(j)] + K1(j)) <<< S1(j);
A1 = D1; D1 = C1; C1 = B1; B1 = T;
T = (A2 + f(63-j, B2, C2, D2) + M[i][R2(j)] + K2(j)) <<< S2(j);
A2 = D2; D2 = C2; C2 = B2; B2 = T;
}
T = h1 + C1 + D2; h1 = h2 + D1 + A2; h2 = h3 + A1 + B2;
h3 = h0 + B1 + C2; h0 = T;
}

5. .

:

h0 || h1 || h2 || h3

- ( 16- ).
RIPEMD128 ("") = cdf26213 a150dc3e cb610f18 f6b38b46
RIPEMD128 ("abc") = c14a1219 9c66e4ba 84636b0f 69144c77
RIPEMD128 ("1234567890123456789012345678901234567890123456789012345
6789012345678901234567890") = 3f45ef19 4732c2db b2c4a2c7 69795fa3

RIPEMD256
1, 2 3 RIPEMD
160.
4. .
( i)
512- .
:

For i = 0 to t-1
{
A1 = h0; B1 = h1; C1 = h2; D1 = h3;
A2 = h4; B2 = h5; C2 = h6; D2 = h7;
For j = 0 to 63
{
T = (A1 + f(j, B1, C1, D1) + M[i][R1(j)] + K1(j)) <<< S1(j);
A1 = D1; D1 = C1; C1 = B1; B1 = T;
T = (A2 + f(63-j, B2, C2, D2) + M[i][R2(j)] + K2(j)) <<< S2(j);
A2 = D2; D2 = C2; C2 = B2; B2 = T;
if j == 15
{ T = A1; A1 = A2; A2 = T; }
if j == 31
{ T = B1; B1 = B2; B2 = T; }
if j == 47
{ T = C1; C1 = C2; C2 = T; }
if j == 63
{ T = D1; D1 = D2; D2 = T; }
}
h0 = h0 + A1; h1 = h1 + B1; h2 = h2 + C1; h3 = h3 + D1;
h4 = h4 + A1; h5 = h5 + B2; h6 = h6 + C2; h7 = h7 + D2;
}

5. .

:

h0 || h1 || h2 || h3 || h4 || h5 || h6 || h7

- ( 16- ).
RIPEMD256 ("") =
02ba4c4e 5f8ecd18 77fc52d6 4d30e37a 2d9774fb 1e5d0263 80ae0168 e3c5522
d
RIPEMD256 ("abc") =
afbd6e22 8b9d8cbb cef5ca2d 03e6dba1 0ac0bc7d cbe4680e 1e42d2e9 75459b6
5
RIPEMD256 ("1234567890123456789012345678901234567890123456789012345
6789012345678901234567890") =
06fdcc7a 409548aa f91368c0 6a6275b5 53e3f099 bf0ea4ed fd6778df 89a890dd

RIPEMD320
1, 2 3 RIPEMD
160.
4. .
( i)
512- .
:
For i = 0 to t-1
{
A1 = h0; B1 = h1; C1 = h2; D1 = h3; E1 = h4;
A2 = h5; B2 = h6; C2 = h7; D2 = h8; E2 = h9;
For j = 0 to 79
{
T = (A1 + f(j, B1, C1, D1) + M[i][R1(j)] + K1(j)) <<< S1(j) + E1;
A1 = E1; E1 = D1; D1 = C1 <<< 10; C1 = B1; B1 = T;
T = (A2 + f(79-j, B2, C2, D2) + M[i][R2(j)] + K2(j)) <<< S2(j) + E2;
A2 = E2; E2 = D2; D2 = C2 <<< 10; C2 = B2; B2 = T;
if j == 15
{ T = B1; B1 = B2; B2 = T; }
if j == 31
{ T = D1; D1 = D2; D2 = T; }
if j == 47
{ T = A1; A1 = A2; A2 = T; }
if j == 63
{ T = C1; C1 = C2; C2 = T; }
if j == 79
{ T = E1; E1 = E2; E2 = T; }
}
h0 = h0 + A1; h1 = h1 + B1; h2 = h2 + C1; h3 = h3 + D1;
h4 = h4 + E1; h5 = h5 + A2; h6 = h6 + B2; h7 = h7 + C2;
h8 = h8 + D2; h9 = h9 + E2;
}

5. .

:

h0 || h1 || h2 || h3 || h4 || h5 || h6 || h7 || h8 || h9

- ( 16- ).
RIPEMD320 ("") =
22d65d56 61536cdc 75c1fdf5 c6de7b41 b9f27325 ebc61e85 57177d70 5a0ec88
0 151c3a32 a00899b8

Grupa MnI31
Levichi Ecaterina
Algoritmul RIPEMD-160

RIPEMD-160 (de la limba englez RACE evaluare de Integritate Mesaj Primitives Digest.) Funcia hash dezvoltat de Universitatea Catolic din Louvain Dobertinom G., A. i B. Prenelem
Bosselaersom. RIPEMD-160 este o versiune mbuntit a RIPEMD, care, la rndul su, a
folosit principiile de MD4 i de performan comparabil cu mai popular SHA-1.
Exist, de asemenea, 128 -, 256 - i 320-bii versiuni ale algoritmului, numit RIPEMD-128,
RIPEMD-256 i RIPEMD-320. 128-bii versiune este doar un nlocuitor al RIPEMD original,
care a fost, de asemenea, un 128-biti, i care au fost gsite vulnerabile. 256 - i 320-bii versiuni
difer dubl lungime Digest, care reduce riscul de coliziuni, dar funciile nu sunt o cript.
RIPEMD-160 a fost proiectat n comunitatea academic deschis, n contrast cu SHA-1 i SHA-2,
care au fost create NSA. Utilizarea RIPEMD-160 nu este limitat de nici un brevet.
Descrierea algoritmului:
Fie un mesaj M n b-bii lungime, funcia hash pe care dori i s calcula i. Iar b poate fi orice
numr ntreg non-negativ, nu neaprat un multiplu al lui 8. Si M un mesaj ce poate fi
reprezentat ca o succesiune de biti: m1 m2 m3 mb2 mb1.
Un mesaj este format din t blocuri, fiecare fiind format din 16 32 de bii de cuvinte Fiecare
cuvnt 32-bii conine patru octei, dar ele nu urmeaz un rnd, i invers (de exemplu, din cei opt
octei (abcdefgh) avem dou cuvinte de 32 biti (dcba hgfe)). Fie M [i] [j] denot cuvntul al julea al blocului i-ulea al mesajului.
Notm prin simbolul "+" modulo 232, adic 2 32, a + b (a + b) mod 232.. Exprimarea "X <<< s"
denota schimbarea ciclic de bii X cu s poziii n stnga.
Pasul 1 i 2. Adugarea bii suplimentari i adugarea lungimea iniial a mesajului.
Aceti pai sunt identice cu etapele 1 i 2 din algoritmul MD5.
Pasul 3. Determinarea constantelor i caracteristici utilizate.
Definim non-liniar bit-funcie f:
x y z,
x y x z ,

f j , x , y , z x y z ,
x z y z ,

x y z ,

0 j 15,
16 j 31,
32 j 47,
48 j 63,
64 j 79.

Determinm cele 16 constante adugate:


00000000,
5A827999,

K1 j 6ED9EBA1 ,
8F1BBCDC ,

A953FD4E ,

0 j 15,
16 j 31,
32 j 47,
48 j 63,
64 j 79.

50A28BE6 ,
5C4DD124,

K 2 j 6D703EF3,
7A6D76E9 ,

00000000,

Gsim numrul de mesaje selectate din cuvintele 32-bii:


R1 (0 .. 15) = 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
R1 (16 .. 31) = 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8
R1 (32 .. 47) = 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12
R1 (48 .. 63) = 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2

0 j 15,
16 j 31,
32 j 47,
48 j 63,
64 j 79.

R1 (64 .. 79) = 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13


R2 (0 .. 15) = 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12
R2 (16 .. 31) = 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2
R2 (32 .. 47) = 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13
R2 (48 .. 63) = 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14
R2 (64 .. 79) = 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11
Determinam numrul de bii care urmeaz s fie pui n aplicarea modificrii:
S1 (0 .. 15) = 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8
S1 (16 .. 31) = 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12
S1 (32 .. 47) = 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5
S1 (48 .. 63) = 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12
S1 (64 .. 79) = 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6
S2 (0 .. 15) = 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6
S2 (16 .. 31) = 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11
S2 (32 .. 47) = 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5
S2 (48 .. 63) = 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8
S2 (64 .. 79) = 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11
Definim valoarea iniial a funciei hash:
h0 = 67452301; h1 = EFCDAB89; h2 = 98BADCFE; h3 = 10325476;
h4 = C3D2E1F0; h5 = 76543210; h6 = FEDCBA98; h7 = 89ABCDEF;
h8 = 01234567; h9 = 3C2D1E0F;
Pasul 4. Principala bucl.
Fiecare iteraie a buclei exterioare (n variabila i) corespunde la prelucrarea unui bloc mesaj de
512-bii. Algoritm de postprocesare in pseudocod este:
For i = 0 to t-1
{
A1 = h0; B1 = h1; C1 = h2; D1 = h3; E1 = h4;
A2 = h0; B2 = h1; C2 = h2; D2 = h3; E2 = h4;
For j = 0 to 79
{
T = (A1 + f(j, B1, C1, D1) + M[i][R1(j)] + K1(j)) <<< S1(j) + E1;
A1 = E1; E1 = D1; D1 = C1 <<< 10; C1 = B1; B1 = T;
T = (A2 + f(79-j, B2, C2, D2) + M[i][R2(j)] + K2(j)) <<< S2(j) + E2;
A2 = E2; E2 = D2; D2 = C2 <<< 10; C2 = B2; B2 = T;
}
T = h1 + C1 + D2; h1 = h2 + D1 + E2; h2 = h3 + E1 + A2;
h3 = h4 + A1 + B2; h4 = h0 + B1 + C2; h0 = T;
}

Pasul 5. Rezultat.
Rezultatul evalurii funciei hash a ntregul mesaj este:

h0 || h1 || h2 || h3 || h4
Exemple de valori hash (n form de 16).
RIPEMD160 ("") = 9c1185a5 c5e9fc54 61280897 7ee8f548 b2258d31

Algoritmul RIPEMD-128
Descrierea algoritmului i paii de 1, 2 i 3 sunt similari cu algoritmul RIPEMD-160.
Pasul 4. Principala bucla.
Fiecare iteraie a buclei exterioare (n variabila i) corespunde la prelucrarea unui bloc mesaj de
512-bii. Algoritm de postprocesare in pseudocod este:
For i = 0 to t-1
{
A1 = h0; B1 = h1; C1 = h2; D1 = h3;
A2 = h0; B2 = h1; C2 = h2; D2 = h3;
For j = 0 to 63
{
T = (A1 + f(j, B1, C1, D1) + M[i][R1(j)] + K1(j)) <<< S1(j);
A1 = D1; D1 = C1; C1 = B1; B1 = T;
T = (A2 + f(63-j, B2, C2, D2) + M[i][R2(j)] + K2(j)) <<< S2(j);
A2 = D2; D2 = C2; C2 = B2; B2 = T;
}
T = h1 + C1 + D2; h1 = h2 + D1 + A2; h2 = h3 + A1 + B2;
h3 = h0 + B1 + C2; h0 = T;
}

Pasul 5. Rezultat.
Rezultatul evalurii funciei hash a ntregului mesaj este:
h0 || h1 || h2 || h3

Exemple de valori hash (n form de 16).


RIPEMD128 ("") = cdf26213 a150dc3e cb610f18 f6b38b46
RIPEMD128 ("abc") = c14a1219 9c66e4ba 84636b0f 69144c77
RIPEMD128 ("1234567890123456789012345678901234567890123456789012345
6789012345678901234567890") = 3f45ef19 4732c2db b2c4a2c7 69795fa3

Algoritmul RIPEMD-256
Descrierea algoritmului i pai de 1, 2 i 3 sunt similare cu algoritmul RIPEMD-160.
Pasul 4. Principalul bucla.
Fiecare iteraie a buclei exterioare (n variabila i) corespunde la prelucrarea unui bloc mesaj de
512-bii. Algoritm de postprocesare in pseudocod este:

Pentru i = 0 la T-1
{
A1 = h0; B1 = h1; C1 = h2; D1 = h3;
A2 = h4; B2 = h5; C2 = h6; D2 = h7;
Pentru j = 0 - 63
{
T = (A1 + f (j, B1, C1, D1) + M [i] [R1 (j)] + K1 (j)) <<< S1 (j);
A1 = D1; D1 = C1; C1 = B1; B1 = T;
T = (A2 + f (63-j, B2, C2, D2) + M [i] [R2 (j)] + K2 (j)) <<< S2 (j);
A2 = D2; D2 = C2; C2 = B2; B2 = T;
dac j == 15
{T = A1; A1 = A2; A2 = T;}
dac j == 31
{T = B1; B1 = B2; B2 = T;}
dac j == 47
{T = C1; C1 = C2; C2 = T;}
dac j == 63
{T = D1; D1 = D2; D2 = T;}
}
H0 = h0 + A1; h1 = h1 + B1; H2 = H2 + C1; h3 = h3 + D1;
h4 = h4 + A1; h5 = h5 + B2; h6 h6 = + C2; H7 H7 = + D2;
}
Pasul 5. Rezultat.
Rezultatul evalurii funciei hash a ntregul mesaj este:
H0 | | H1 | | H2 | | H3 | | H4 | | H5 | | H6 | | h7
Exemple de valori hash (n form de 16-rie).
RIPEMD256 ("") = 02ba4c4e 5f8ecd18 77fc52d6 4d30e37a 2d9774fb 1e5d0263 80ae0168
e3c5522d
RIPEMD256 ("abc") = afbd6e22 8b9d8cbb cef5ca2d 03e6dba1 0ac0bc7d cbe4680e 1e42d2e9
75459b65
RIPEMD256
("1234567890123456789012345678901234567890123456789012345678901234567890123456
7890") = 06fdcc7a 409548aa f91368c0 6a6275b5 53e3f099 bf0ea4ed fd6778df 89a890dd
Algoritmul RIPEMD-320
Descrierea algoritmului i pai de 1, 2 i 3 sunt similare cu algoritmul RIPEMD-160.
Pasul 4. Principalul bucla.
Fiecare iteraie a buclei exterioare (n variabila i) corespunde la prelucrarea unui bloc mesaj de
512-bii. Algoritm de postprocesare in pseudocod este:
Pentru i = 0 la T-1
{
A1 = h0; B1 = h1; C1 = h2; D1 = h3; E1 = h4;
A2 = h5; B2 = h6; C2 = H7; D2 = h8; E2 = H9;
Pentru j = 0 - 79
{
T = (A1 + f (j, B1, C1, D1) + M [i] [R1 (j)] + K1 (j)) <<< S1 (j) + E1;
A1 = E1; E1 = D1; D1 = C1 <<< 10; C1 = B1; B1 = T;
T = (A2 + f (79-j, B2, C2, D2) + M [i] [R2 (j)] + K2 (j)) <<< S2 (j) + E2;
A2 = E2; E2 = D2; D2 = C2 <<< 10; C2 = B2; B2 = T;
dac j == 15
{T = B1; B1 = B2; B2 = T;}

dac j == 31
{T = D1; D1 = D2; D2 = T;}
dac j == 47
{T = A1; A1 = A2; A2 = T;}
dac j == 63
{T = C1; C1 = C2; C2 = T;}
dac j == 79
{T = E1; E1 = E2; E2 = T;}
}
H0 = h0 + A1; h1 = h1 + B1; H2 = H2 + C1; h3 = h3 + D1;
h4 = h4 + E1; h5 = h5 + A2; h6 h6 = + B2; H7 H7 = + C2;
H8 H8 = + D2; h9 = h9 + E2;
}
Pasul 5. Rezultat.
Rezultatul evalurii funciei hash a ntregul mesaj este:
H0 | | H1 | | H2 | | H3 | | H4 | | H5 | | H6 | | H7 | | h8 | | H9
Exemple de valori hash (n form de 16-rie).
RIPEMD320 ("") = 22d65d56 61536cdc 75c1fdf5 c6de7b41 b9f27325 ebc61e85 57177d70
5a0ec880 151c3a32 a00899b8a