Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Internet.Security

.pdf
Скачиваний:
43
Добавлен:
10.02.2015
Размер:
3.75 Mб
Скачать

130

INTERNET SECURITY

 

 

P(Ω1)

P(Ω2)

P(Ω3)

P(Ω4)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Y1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

97a0e99a

 

 

 

 

 

 

 

 

 

 

 

Y2

 

 

371d4fc8

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<<< 5

 

 

 

 

 

 

 

<<< 10

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Y

 

H1

 

 

 

 

 

 

 

 

 

 

 

 

 

H2

 

 

 

 

 

 

 

| |

 

 

 

 

 

L

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

F

 

 

 

 

 

 

 

 

 

 

 

 

 

 

M

 

 

 

h = (H1 || H2) = f41d3352753f20dc

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

A

 

 

 

 

 

 

 

 

 

Figure 4.3 64-bit hash code computation scheme.

 

 

 

 

 

 

 

 

 

 

E

 

 

 

 

 

 

 

 

 

 

 

 

 

T

f41d3352753f20dc

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Decimation

h = 001110011101110001

Figure 4.4 18-bit hash code computation scheme.

Discard six bits from both ends of the 64-bit message digest h and then pick one bit every three bits by the rule of decimation such that

h = 001110011101110001 (18 bits)

128-bit hash code computation (using left shift):

Referring to Figure 4.5, each P( i ) is shifted m bits to the left. Then concatenating them will produce the 128-bit message digest:

H1 = 7b1b1c00

H2 = a1d34e7c

Team-Fly®

 

 

 

 

 

 

HASH FUNCTION, MESSAGE DIGEST AND HMAC

131

 

 

 

P(Ω1)

 

 

P(Ω2)

 

 

P(Ω3)

 

 

P(Ω4)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<<< 7

 

 

<<< 10

 

 

<<< 15

 

 

<<< 5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

7b1b1c00

H1

 

a1d34e7c

H2

 

59b14b55

H3

bf113dcb

H4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

| |

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

h = (H1 || H2 || H3 || H4) = 7b1b1c00 a1d34e7c 59b14b55 bf113dcb

 

 

 

 

 

 

 

 

Figure 4.5 128-bit hash code computation using a shift left.

 

 

 

 

H3

= 59b14b55

 

 

 

 

 

 

 

 

 

 

 

 

 

 

H4

= bf113dcb

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Thus, the 128-bit hash code will be

h= (H1||H2||H3||H4)

= 7b1b1c00a1d34e7c59b14b55bf113dcb

128-bit hash code computation (using inverse):

Based on Figure 4.6, another 128-bit message digest can be computed as follows:

X1

= 00f6

X2

= 3638

 

 

X3 = 9f28

X4

= 74d3

X−1

=

9b24

X

c9c8

X

60d8

X−1

=

8e12

1

 

2 =

 

 

3

=

 

4

 

Z1

= 96aa

Z2

= b362

 

 

Z3 = 5df8

Z4

= 89ee

Z−1

=

bf34

Z

 

4c9e

Z

=

a208

Z−1

=

b652

1

 

2 =

 

3

 

4

 

Thus, the 128-bit hash code is computed from the concatenation of inverse values:

h= (X1−1|| − X2|| − X3||X4−1||Z1−1|| − Z2|| − Z3||Z4 1

= 9d24c9c860d88e12bf344c9ea208b652

128-bit hash code computation (using addition and

Taking a look at Figure 4.7, computation for the follows:

P( 1) + P( 3) = 97a0e99a <<< 5 = f41d3352

P( 2) P( 4) = 371d4fc8 <<< 10 = 753f20dc

)

multiplication):

128-bit message digest proceeds as

132

 

 

 

 

 

 

 

 

 

 

 

 

INTERNET SECURITY

 

 

 

 

 

 

 

 

 

 

 

 

 

 

P(Ω1)

 

 

 

 

P(Ω2)

 

 

 

 

 

 

P(Ω3)

 

 

 

 

P(Ω4)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X1

 

 

 

X2

 

X3

 

 

 

X4

 

 

 

Z1

 

 

 

Z2

 

Z3

 

 

 

Z4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

00f6

 

3638

 

9f28

 

74d3

 

 

 

96aa

 

b362

 

5df8

 

89ee

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X1−1

 

 

 

X2

 

X3

 

 

 

X4−1

 

 

 

Z1−1

 

 

 

Z2

 

Z3

 

 

 

Z4−1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

9d24

 

c9c8

 

60d8

 

8e12

 

 

 

bf34

 

4c9e

 

a208

 

b652

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

| |

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

9d24c9c8 60d88e12 bf344c9e a208b652

Figure 4.6 128-bit hash code computation using inverse operation.

P(Ω1)

P(Ω2)

P(Ω3)

P(Ω4)

97a0e99a

 

371d4fc8

 

 

 

 

56c9017f

fd20fec1

<<< 5

<<<10

<<<10

<<<5

| |

f41d3352 753f20dc a41fd83f 2405fd5b 128-bit hash code

Figure 4.7 128-bit hash code computation using addition and multiplication.

P( 1) P( 3) = 56c9017f <<< 10 = 2405fd5b

P( 2) + P( 4) = fd20fec1 <<< 5 = a41fd83f

h= (P( 1) + P( 3)) <<< 5||(P( 2) P( 4)) <<< 10|| (P( 2) + P( 4)) <<< 5||(P( 2) P( 3)) <<< 10

=f41d3352 753f20dc a41fd83f 2405fd5b(128bits)

HASH FUNCTION, MESSAGE DIGEST AND HMAC

133

Sin

F(r)

<<< 1

LSB

0 or 1

PK

Sout

LSB : Least significant bit of input value

: Exclusive OR

: multiplication

PK : 32-bit constant (ex. 0x000000AE)

Figure 4.8 State transition function F(r) for PRBS generation.

This is the 128-bit hash code found. So far, we have discussed computation for the DMDC without appending a one-bit flag and the message length in hex digits.

4.2 Advanced DMDC Algorithm

This section presents the secure DMDC algorithm for providing an acceptable level of security.

4.2.1Key Schedule

Figure 4.10 shows the newly devised key generation scheme. The 64-bit input key reshapes to the 56-bit key sequence through Table 3.1 (PC-1). The 56-bit keys are loaded into two 28-bit registers (C0, D0). The contents of these two registers are shifted by the SLi and SRi positions to the left. SLr and SRr are generated by the state transition function F(r) shown in Figures 4.8 and 4.10. In Figure 4.10, the 64-bit input key is separated into two 32 bits. Each becomes the input Sin to F(r). SLr and SRr are computed from Sout (mod 23). LFSR in Figure 4.9 is the device for the generation of a pseudo-random binary sequence (PRBS), whose characteristic function is:

f(x) = x32 + x7 + x5 + x3 + x2 + x + 1 of a period 232 − 1

The 64-bit input key is assumed to be 7a138b2524af17c5. Using Figure 4.11, entire round keys are computed, as shown in Table 4.2.

134

 

 

 

 

INTERNET SECURITY

 

 

 

D0

D1

D2

 

D3

D4

D5 D6

D7

D8

D9

D30 D31

 

x

x2

x3

x4

x5

x6

x7

x8

x9

x32

Figure 4.9 LFSR with the primitive polynomial f(x) = 1 + x + x2 generation.

 

 

 

 

 

 

 

 

Input key

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

64 bits

 

 

 

 

 

 

 

 

 

 

 

32 bits

 

32 bits

 

 

 

 

64 bits

 

 

 

 

 

 

 

 

 

 

 

Repeat for

 

 

PC-1

 

 

 

 

 

 

 

 

 

 

F(r)

 

 

F(r)

 

 

 

 

 

 

 

 

 

 

31 times

 

 

 

 

 

56 bits

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

F(r)

 

 

F(r)

 

28 bits

 

 

 

 

28 bits

 

 

 

 

 

 

 

 

 

S1L

 

 

 

C0

 

 

 

D0

 

 

 

 

 

 

 

 

mod 23

<<<

 

 

 

 

 

 

 

 

 

 

 

S1R

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

mod 23

 

 

 

 

 

<<<

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

C1

 

 

 

 

 

 

| |

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D1

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

F(r)

 

 

F(r)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S2L

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

mod 23

<<<

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SR2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

mod 23

 

 

 

 

 

<<<

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

C2

 

 

 

 

 

 

| |

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

F(r)

 

 

F(r)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SLr

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

mod 23

<<<

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SRr

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

mod 23

 

 

 

 

 

<<<

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Cr

 

 

 

 

 

 

| |

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Dr

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Repeat for all message sub-blocks

 

 

 

 

 

 

 

+ x3 + x5 + x7 + x32 for PRBS

Round 1

PC-2* K1

Round 2

PC-2* K2

Round r

PC-2* Kr

F(r): PRBS state change function mod 23: modulo 23

PC-1: Permuted choice 1

PC-2*: Permuted choice 2 and row/column wise permutation

<<<: Circular left shift ||: Concatenation

Figure 4.10 The newly devised DMDC key generation scheme.

HASH FUNCTION, MESSAGE DIGEST AND HMAC

135

Mr 0

A

Mr 1

B

Mr 2

C

Mr 3

D

 

|

|

 

 

 

| |

 

 

IP

 

 

 

IP

 

L1 = 32 bits

R1 = 32 bits

L2 = 32 bits

R2 = 32 bits

E(L1) = 48

E(R1) = 48

E(L2) = 48

E(R2) = 48

 

 

 

<<< 3

 

K4

 

 

 

 

 

 

 

 

 

 

 

K3

 

 

 

 

 

 

<<< 1

 

 

 

 

 

K2

 

 

 

 

 

 

<<< 2

 

 

 

 

 

K1

 

 

 

 

 

 

 

Kr

 

 

 

 

 

 

 

Γ1 = E(L1) K1

Γ2 = E(R1) K2

Γ3 = E(L2) K3

Γ4 = E(R2) K4

(S-box)1

 

(S-box)2

(S-box)3

 

(S-box)4

 

1 (32 bits)

2 (32 bits)

3 (32 bits)

 

4 (32 bits)

Π(Ω1) (32 bits)

Π(Ω2) (32 bits)

Π(Ω3) (32 bits)

Π(Ω4) (32 bits)

: Concatenation

 

 

 

 

 

 

 

IP : Initial permutation

 

 

 

 

 

 

 

 

A

 

B

C

 

D

 

Figure 4.11 New DMDC algorithm for message digest.

136 INTERNET SECURITY

Table 4.2 Round key generation corresponding to (SL, SR)

 

 

r r

rth round

(SL, SR )

Kr (rth round key)

 

r r

 

1

(2, 21)

36320340397a

2

(14, 19)

9394d0aac24c

3

(0, 15)

91c2c6fcd01e

4

(7, 7)

fcf6701c06a4

5

(21, 13)

c38496e8c45e

6

(1, 20)

12f64d47235d

7

(7, 17)

174a16a3c335

.

.

.

.

.

.

.

.

.

332

(21, 2)

17320b413872

333

(19, 17)

9ad8226cd646

334

(1, 11)

961203c1315b

335

(2, 18)

125ec46f8a55

336

(2, 13)

cd8d4610f0c4

337

(19, 9)

5e40db051358

338

(15, 8)

0414fc86b547

 

 

 

4.2.2Computation of Message Digests

After the input message M of arbitrary length appends padding, divide the padded message into the integer multiple of 128 bits such that M1, M2, . . . , ML. Each Mi again positions to four 32-bit words as:

M10, M11, M12, M13, M20, M21, M22, M23, . . . , ML0, ML1, ML2, ML3

where Mr = (Mr0, Mr1, Mr2, Mr3) represents the rth round 128-bit message unit as shown in Figure 4.11. A, B, C and D denote the four 32-bit buffers in which the data computed at the (r − 1)th round is to be stored. Thus, Mr0 A, Mr1 B, Mr2 C and Mr3 D will become the rth round input data. Notice that the output at each round is swapped such that the data diffusion becomes very effective.

The following example demonstrates motivation, so that the reader can understand the whole process at each round (Figure 4.11). The ASCII file structure for the input message is assumed to be as shown below:

001: 12345678901234567890 002: 23456789012345678901 003: 34567890123456789012

.

.

.

198:89012345678901234567

199:90123456789012345678

200:01234567890123456789

After receiving this ASCII file as input, the 128-bit divided blocks are expressed in hexadecimal notation as follows:

HASH FUNCTION, MESSAGE DIGEST AND HMAC

137

3030313a

20313233

34353637

38393031

 

32333435

36373839

300d0a30

30323a20

 

32333435

36373839

30313233

34353637

 

 

. . . . .

 

 

 

3a203031

32333435

36373839

30313233

 

34353637

38398000

00000000

0000a8b0

 

In the last block, the last three words contain padding and message length. The message length is 0xa8b0(43184 in decimal).

The swapped outputs A, B, C and D at each round are computed as shown in Table 4.3.

Thus, the hash code computations applied to the new DMDC algorithm are listed in Table 4.4.

The DMDC algorithm is a secure, compact and simple hash function. The security of DMDC has never been mathematically proven, but it depends on the problem of F(r) generating the PRBS sequence which makes each 28-bit key (left and right) shift to the

Table 4.3 The swapped output A, B, C and D at each round

Round

A

B

C

D

 

 

 

 

 

1

3b1b9ba3

d126ddbe

bd3a26d1

67cfb0f3

2

f51e7b49

867a615d

b2990b90

d49538dd

3

06b402c3

a6fd207f

256bdeb5

efdd2572

4

c549ff13b

bceaa5a7

0d1cee9e

a335cf90

5

68433a67

94f78e05

7c72e14f

a32eae10

6

9e53f8b6

5d6b7335

4574651e

9b1b6489

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

333

0b4cbc7b

5abebd16

ccae2d5b

b50606d1

334

36ae1c4b

03b94506

89304464

28457cce

335

c530fa5f

f48260b2

1f8e5c7f

814a2152

336

487df0b3

e046c2c9

999e1066

f27ba5d3

337

58804c4c

223ee9ae

fd265d3a

7894aa4c

338

ee0fd67d

fda0da6a

df5c7095

94287b6c

 

 

 

 

 

Table 4.4 Hash code values based on the new DMDC scheme

Hash code length

Hash value

 

 

32 bits

5f79ee7e

64 bits

ad88e2594fe4287a

18 bits

32064

using left shift

07eb3ef78369abf6384aefae850f6d92

using inverse

ad88e2594fe4287a392abad213122695

128 bits

10c62983026032634cdc8f6b6bd84085

using addition and

multiplication

 

 

 

138

INTERNET SECURITY

left. The secure DMDC processes data sequentially block-by-block of a 128-bit unit when computing the message digest. The computation uses four working registers labelled A, B, C and D. These register contents are the swapped outputs at the end of each round. The four 32-bit input unit are XORed with the register contents. This process offers good performance and considerable flexibility.

4.3 MD5 Message-digest Algorithm

The MD5 message-digest algorithm was developed by Ronald Rivest at MIT in 1992. This algorithm takes a input message of arbitrary length and produces a 128-bit hash value of the message. The input message is processed in 512-bit blocks which can be divided into 16 32-bit subblocks. The message digest is a set of four 32-bit blocks, which concatenate to form a single 128-bit hash code. MD5 (1992) is an improved version of MD4, but is slightly slower than MD4 (1990).

The following steps are carried out to compute the message digest of the input message.

4.3.1 Append Padding Bits

The message is padded so that its length (in bits) is congruent to 448 modulo 512. That is, the padded message is just 64 bits short of being a multiple of 512. This padding is formed by appending a single ‘ 1’ bit to the end of the message, and then ‘ 0’ bits are appended as needed such that the length (in bits) of the padded message becomes congruent to 448 (= 512 − 64), modulo 512.

4.3.2 Append Length

A 64-bit representation of the original message length is appended to the result of the previous step. If the original length is greater than 264, then only the low-order 64 bits of the length are used for appending two 32-bit words.

The length of the resulting message is an exact multiple of 512 bits. Equivalently, this message has a length that is an exact multiple of 16 (32-bit) words. Let M[0 . . . N − 1] denote the word of the resulting message, with N an integer multiple of 16.

4.3.3 Initialise MD Buffer

A four-word buffer represents four 32-bit registers (A, B, C and D). This 128-bit buffer is used to compute the message digest. These registers are initialised to the following values in hexadecimal (low-order bytes first):

A = 01 23 45 67

B = 89 ab cd ef

C = fe dc ba 98

D = 76 54 32 10

HASH FUNCTION, MESSAGE DIGEST AND HMAC

139

These four variables are then copied into different variables: A as AA, B as BB, C as CC and D as DD.

4.3.4Define Four Auxiliary Functions (F, G, H, I)

F, G, H and I are four basic MD5 functions. Each of these four nonlinear functions takes three 32-bit words as input and produces one 32-bit word as output. They are, one for each round, expressed as:

F(X, Y, Z) = (XY) + (XZ)

G(X, Y, Z) = (XZ) + (YZ)

H(X, Y, Z) = X Y Z

I(X, Y, Z) = Y (X + Z)

where XY denotes the bitwise AND of X and Y; X + Y denotes the bitwise OR of X and Y; X denotes the bitwise complement of X, i.e. NOT(X); and X Y denotes the bitwise XOR of X and Y.

These four nonlinear functions are designed in such a way that if the bits of X, Y and Z are independent and unbiased, then at each bit position the function F acts as a conditional: if X then Y else Z. The functions G, H and I are similar to the function F in that they act in ‘bitwise parallel’ to their product from the bits of X, Y and Z. Notice that the function H is the bitwise XOR function of its inputs.

The truth table for the computation of four nonlinear functions (F, G, H, I) is given in Table 4.5.

4.3.5FF, GG, HH and II Transformations for Rounds 1, 2, 3 and 4

If M[k], 0 ≤ k ≤ 15, denotes the kth sub-block of the message, and <<< s represents a left shift s bits, the four operations are defined as follows:

FF(a, b, c, d, M[k], s, i) : a = b + ((a + F(b, c, d) + M[k] + T[i] <<< s)

GG(a, b, c, d, M[k], s, i) : a = b + ((a + G(b, c, d) + M[k] + T[i] <<< s)

Table 4.5 Truth table of four nonlinear functions

XYZ

FGHI

 

 

000

0001

001

1010

010

0110

011

1001

100

0011

101

0101

110

1100

111

1110

 

 

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]