Cryptography Reference
In-Depth Information
Algorithm 8.7
Round 2 of the MD5 hash function.
1.
A ←
(
A
+
g
(
B, C, D
)+
X
[1] +
T
[17])
←
5
2.
D ←
(
D
+
g
(
A, B, C
)+
X
[6] +
T
[18])
←
9
3.
C ←
(
C
+
g
(
D, A, B
)+
X
[11] +
T
[19])
←
14
4.
B ←
(
B
+
g
(
C, D, A
)+
X
[0] +
T
[20])
←
20
5.
A ←
(
A
+
g
(
B, C, D
)+
X
[5] +
T
[21])
←
5
6.
D ←
(
D
+
g
(
A, B, C
)+
X
[10] +
T
[22])
←
9
7.
C ←
(
C
+
g
(
D, A, B
)+
X
[15] +
T
[23])
←
14
8.
B ←
(
B
+
g
(
C, D, A
)+
X
[4] +
T
[24])
←
20
9.
A ←
(
A
+
g
(
B, C, D
)+
X
[9] +
T
[25])
←
5
10.
D
←
(
D
+
g
(
A, B, C
)+
X
[14] +
T
[26])
←
9
11.
C
←
(
C
+
g
(
D, A, B
)+
X
[3] +
T
[27])
←
14
12.
B
←
(
B
+
g
(
C, D, A
)+
X
[8] +
T
[28])
←
20
13.
A
←
(
A
+
g
(
B, C, D
)+
X
[13] +
T
[29])
←
5
14.
D
9
15.
C ←
(
C
+
g
(
D, A, B
)+
X
[7] +
T
[31])
←
14
16.
B ←
(
B
+
g
(
C, D, A
)+
X
[12] +
T
[32])
←
20
←
(
D
+
g
(
A, B, C
)+
X
[2] +
T
[30])
←
i
(
X, Y, Z
)=
Y
⊕
(
X
∨
(
¬
Z
))
The truth table of the logical functions
f
,
g
,
h
,
i
is illustrated in Table 8.3.
Furthermore, the MD5 hash function uses a 64-element table
T
constructed from
the sine function. Let
T
[
i
] be the
i
th
element of the table, then
T
[
i
]=
4
,
294
,
967
,
296
·|
sin(
i
)
|
where
i
is in radians. Because 4
,
294
,
967
,
296 is equal to 2
32
and
is a
number between 0 and 1, each element of
T
is an integer that can be represented in
32 bits. Consequently, the table
T
provides a “randomized” set of 32-bit patterns,
which should eliminate any regularities in the input data. The elements of
T
as
employed by the MD5 hash function are listed in Table 8.4.
The MD5 hash function is overviewed in Algorithm 8.5. It is structurally sim-
ilar to the MD4 hash function. The four rounds of MD5 are specified in Algorithms
8.6-8.9.
Again, a reference implementation of the MD5 hash function (in the C
programming language) is provided in Appendix A of the relevant RFC 1321 [7].
|
sin(
i
)
|