Cryptography Reference
In-Depth Information
Algorithm 8.8
Round 3 of the MD5 hash function.
1.
A ←
(
A
+
h
(
B, C, D
)+
X
[5] +
T
[33])
←
4
2.
D ←
(
D
+
h
(
A, B, C
)+
X
[8] +
T
[34])
←
11
3.
C ←
(
C
+
h
(
D, A, B
)+
X
[11] +
T
[35])
←
16
4.
B ←
(
B
+
h
(
C, D, A
)+
X
[14] +
T
[36])
←
23
5.
A ←
(
A
+
h
(
B, C, D
)+
X
[1] +
T
[37])
←
4
6.
D ←
(
D
+
h
(
A, B, C
)+
X
[4] +
T
[38])
←
11
7.
C ←
(
C
+
h
(
D, A, B
)+
X
[7] +
T
[39])
←
16
8.
B ←
(
B
+
h
(
C, D, A
)+
X
[10] +
T
[40])
←
23
9.
A ←
(
A
+
h
(
B, C, D
)+
X
[13] +
T
[41])
←
4
10.
D
←
(
D
+
h
(
A, B, C
)+
X
[0] +
T
[42])
←
11
11.
C
←
(
C
+
h
(
D, A, B
)+
X
[3] +
T
[43])
←
16
12.
B
←
(
B
+
h
(
C, D, A
)+
X
[6] +
T
[44])
←
23
13.
A
←
(
A
+
h
(
B, C, D
)+
X
[9] +
T
[45])
←
4
14.
D
11
15.
C ←
(
C
+
h
(
D, A, B
)+
X
[15] +
T
[47])
←
16
16.
B ←
(
B
+
h
(
C, D, A
)+
X
[2] +
T
[48])
←
23
←
(
D
+
h
(
A, B, C
)+
X
[12] +
T
[46])
←
8.3.3
SHA-1
The SHA-1 hash function is conceptually and structurally similar to MD4 and MD5.
The two most important differences are that SHA-1 was designed to run optimally
on computer systems with a big-endian architecture (rather than a little-endian
architecture) and that it employs five registers (instead of four) and hence outputs
hash values of 160 bits.
The SHA-1 hash function uses a sequence of functions
f
0
,
f
1
, ...,
f
79
that are
defined as follows:
Ch
(
X, Y, Z
)=(
X
∧
Y
)
⊕
¬
X
)
∧
Z
)
≤
t
≤
((
0
19
Parity
(
X, Y, Z
)=
X
⊕
Y
⊕
Z
20
≤
t
≤
39
f
t
(
X, Y, Z
)=
Maj
(
X, Y, Z
)=(
X
∧
Y
)
⊕
(
X
∧
Z
)
⊕
(
Y
∧
Z
)40
≤
t
≤
59
Parity
(
X, Y, Z
)=
X
⊕
Y
⊕
Z
60
≤
t
≤
79
The truth table of the logical functions employed by SHA-1 is illustrated in
Tab le 8 . 5 .
Furthermore, the function uses a sequence of 80 constant 32-bit words
K
0
,
K
1
, ...,
K
79
that are defined as follows: