
Internet.Security
.pdf
®Fly-Team
Round |
Value |
|
Round |
Value |
|
|
|
|
|
|
|
1 |
A = S[0] = bf0a8b1d, B = L[0] = db0a1d55 |
|
40 |
A = S[13] = 60e93e12, B = L[3] = 160c2277 |
|
2 |
A = S[1] = 816b9c77, B = L[1] = 7fb8aae2 |
|
41 |
A = S[14] = 8595c842, B = L[0] = c517db63 |
|
3 |
A = S[2] = aba46177, B = L[2] = 785a04c3 |
|
42 |
A = S[15] = 262d9406, B = L[1] = 3cc0d68d |
|
4 |
A = S[3] = b4312645, B = L[3] = 59d418be |
|
43 |
A = S[16] = 5d4e600c, B = L[2] = 1d9e8680 |
|
5 |
A = S[4] = f623ba51, B = L[0] = f8321580 |
|
44 |
A = S[17] = 9a469d73, B = L[3] = 33566f8a |
|
6 |
A = S[5] = ea640e8d, B = L[1] = d9ddec49 |
|
45 |
A = S[18] = 16e6853d, B = L[0] = aa681507 |
|
7 |
A = S[6] = 8b813479, B = L[2] = 76e49617 |
|
46 |
A = S[19] = 98464d27, B = L[1] = ce2edfdb |
|
8 |
A = S[7] = 6e5b8010, B = L[3] = 8a17729f |
|
47 |
A = S[20] = 1309c416, B = L[2] = 54e3fdae |
|
9 |
A = S[8] = 10808ed5, B = L[0] = 6f492ca1 |
|
48 |
A = S[21] = 652071c0, B = L[3] = b7be3b56 |
|
10 |
T |
A = S[22] = 1eafced6, B = L[0] = 61f3380d |
|||
A = S[9] = 3cf2a2d6, B = L[1] = e0430cdd |
|
49 |
|||
11 |
A = S[10] = 1a0e1280, B = L[2] = 8e26b6ae |
|
50 |
A = S[23] = a88500d9, B = L[1] = 29c63076 |
|
12 |
A = S[11] = 63c2ac21, B = L[3] = 6ab73e00 |
E |
A = S[24] = 704825b0, B = L[2] = bc94f53b |
||
|
51 |
||||
13 |
A = S[12] = 87a78187, B = L[0] = d3f61430 |
|
52 |
= S[25] = 255565cd, B = L[3] = a8965e99 |
|
14 |
A = S[13] = e280abf8, B = L[1] = b9cd0596 |
|
A |
= 344f019e |
|
|
53 |
= S[0] = 6d835afc, B = L[0] |
|||
15 |
A = S[14] = d9bd587f, B = L[2] = 98643622 |
|
54 |
= S[1] = 7d15cd97, B = L[1] = f57b655f |
|
16 |
A = S[15] = 7a180edb, B = L[3] = afa6705f |
|
M |
= 530ea3bb |
|
|
55 |
= S[2] = 0942b409, B = L[2] |
|||
17 |
A = S[16] = 28bb616e, B = L[0] = fcbfb58a |
|
56 |
= S[3] = 32f9c923, B = L[3] = cba7b2dd |
|
18 |
A = S[17] = f85bed22, B = L[1] = 8a842aee |
|
57 |
= S[4] = a811fb02, B = L[0] = d40457be |
|
19 |
A = S[18] = d53fc3aa, B = L[2] = baf82824 |
|
58 |
F |
= 9c37c14b |
|
= S[5] = 64f121e8, B = L[1] |
||||
20 |
A = S[19] = 31ba2f60, B = L[3] = c58c7e39 |
|
59 |
A = S[6] = d1cc8b4e, B = L[2] = a98225e0 |
|
21 |
A = S[20] = 5bec0b80, B = L[0] = 863c707e |
|
60 |
L |
= 8b962ed8 |
|
A = S[7] = e8873e6f, B = L[3] |
||||
22 |
A = S[21] = a4b64c74, B = L[1] = 9f82d5db |
|
61 |
Y |
= 128e06a1 |
|
A = S[8] = 61399bbb, B = L[0] |
||||
23 |
A = S[22] = a6f74cc4, B = L[2] = 80b92561 |
|
62 |
A = S[9] = f1b91926, B = L[1] = 3f708950 |
|
24 |
A = S[23] = b46d9938, B = L[3] = a5f56679 |
|
63 |
A = S[10] = ac661520, B = L[2] = c4509558 |
|
25 |
A = S[24] = 3bbdd367, B = L[0] = 67efaa5e |
|
64 |
A = S[11] = a21a31c9, B = L[3] = e401ebf3 |
|
26 |
A = S[25] = 77cd91ce, B = L[1] = 012077f4 |
|
65 |
A = S[12] = d424808d, B = L[0] = cab47321 |
|
27 |
A = S[0] = bfc4a6f9, B = L[2] = c889c833 |
|
66 |
A = S[13] = fe118e07, B = L[1] = 368a7808 |
|
28 |
A = S[1] = 4dd05d18, B = L[3] = 7c5e25e2 |
|
67 |
A = S[14] = d18e728d, B = L[2] = fdb98d2f |
|
29 |
A = S[2] = ae97238b, B = L[0] = 9e79725c |
|
68 |
A = S[15] = abac9e17, B = L[3] = 5a05ce63 |
|
30 |
A = S[3] = 0a0de160, B = L[1] = 0a9a7cbb |
|
69 |
A = S[16] = 18066433, B = L[0] = 6dcf3029 |
|
31 |
A = S[4] = 5660c360, B = L[2] = 714c2842 |
|
70 |
A = S[17] = 00e18e79, B = L[1] = 94ecdaaa |
|
32 |
A = S[5] = 9087d17d, B = L[3] = bf190fd0 |
|
71 |
A = S[18] = 65a77305, B = L[2] = ed6f7c26 |
|
33 |
A = S[6] = d910ae36, B = L[0] = a8cc188d |
|
72 |
A = S[19] = 5ae9e297, B = L[3] = 144be5a4 |
|
34 |
A = S[7] = 81c2369f, B = L[1] = 8cbe7352 |
|
73 |
A = S[20] = 11fc628c, B = L[0] = 78599417 |
|
35 |
A = S[8] = f809c630, B = L[2] = d8518713 |
|
74 |
A = S[21] = 7bb3431f, B = L[1] = 78223e6c |
|
36 |
A = S[9] = 6a6f80c8, B = L[3] = 580ed0bd |
|
75 |
A = S[22] = 942a8308, B = L[2] = d9af9bc3 |
|
37 |
A = S[10] = e463202e, B = L[0] = f04bc729 |
|
76 |
A = S[23] = b2f8fd20, B = L[3] = 07a3f43d |
|
38 |
A = S[11] = c38c9bc1, B = L[1] = 5b58f102 |
|
77 |
A = S[24] = 5728b869, B = L[0] = c9902f75 |
|
39 |
A = S[12] = 34687255, B = L[2] = 35340975 |
78 |
A = S[25] = 30726d5a, B = L[1] = 6d9db912 |
||
|
|
|
|
|
|
90
SECURITY INTERNET

SYMMETRIC BLOCK CIPHERS |
91 |
3.3.3 Encryption
The input block to RC5 consists of two w-bit words given in two registers, A and B. The output is also placed in the registers A and B. Recall that RC5 uses an expanded key table, S[0, 1, . . . , t − 1], consisting of t = 2(r + 1) words. The key-expansion algorithm initialises S from the user’s given secret key parameter K. However, the S table in RC5 encryption is not like an S-box used by DES. The encryption algorithm is given in the pseudocode as shown below:
A = A + S[0];
B = B + S[1];
for i = 1 to r do
A = ((A B) <<< B) + S[2i];
B = ((B A) <<< A) + S[2i + 1];
The output is in the registers A and B.
Example 3.14 Consider again RC5-32/12/16. To encrypt the 64-bit input block, use of the following steps:
1 Use the expanded key table S[0, 1, . . . , 25] already computed in Example 3.13. 2 Input the plaintext in two 32-bit registers, A and B.
3 Compute the ciphertext using the RC5 encryption algorithm according to Figure 3.10.
Encryption process
Round |
A |
B |
|
|
|
0 |
5c5f001d |
eaa518ac |
1 |
aacdcf78 |
073A31fa |
2 |
b2c9dafc |
d0506098 |
3 |
362f2508 |
67cccf55 |
4 |
ace3d838 |
5f84483d |
5 |
6ad30720 |
d77180e6 |
6 |
3cc6723c |
accd0d34 |
7 |
c2177344 |
9954851d |
8 |
436ee2fe |
f7702871 |
9 |
fac6db42 |
91c5af63 |
10 |
6a180397 |
f63131f5 |
11 |
e07e082e |
816fc2b3 |
12 |
ac13c0f7 |
52892b5b |
Ciphertext = ac13c0f7 52892b5b

92 |
INTERNET SECURITY |
3.3.4 Decryption
RC5 decryption is given in the pseudocode as shown below.
For i = r down to 1 do
B= ((B − S[2i + 1]) >>> A) A A = ((A − S[2i]) >>> B) B
B= B − S[1]
A = A − S[0]
The decryption routine is easily derived from the encryption routine. The RC5 encryption/decryption algorithms are illustrated as shown in Figures 3.10 and 3.11, respectively.
Example 3.15 Consider the decryption problem of RC5-32/12/16. To decrypt the ciphertext obtained in Example 3.14, the output of round 11 is inputted into two 32-bit
|
A |
|
B |
||||||||||
|
|
|
|
|
|
S[0] |
|
|
|
|
|
|
S[1] |
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Repeat for i rounds
S[2i]
S[2i + 1]
A B
Figure 3.10 RC5 encryption algorithm.

|
SYMMETRIC BLOCK CIPHERS |
93 |
A |
B |
|
−S[2i + 1]
−S[2i]
Repeat for i rounds
|
|
|
|
|
|
|
−S[0] |
|
|
|
|
|
|
−S[1] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
A |
|
B |
Figure 3.11 RC5 decryption algorithm.
registers, A and B, and the following steps are taken according to the RC5 decryption algorithm.
Decryption process
Round |
A |
B |
|
|
|
12 |
e07e082e |
816fc2b3 |
11 |
6a180397 |
f63131f5 |
10 |
fac6db42 |
91c5af63 |
9 |
436ee2fe |
f7702871 |
8 |
c2177344 |
9954851d |
7 |
3cc6723c |
accd0d34 |
6 |
6ad30720 |
d77180e6 |
5 |
ace3d838 |
5f84483d |
4 |
362f2508 |
67cccf55 |
3 |
b2c9dafc |
d0506098 |
2 |
aacdcf78 |
073a31fa |
1 |
5c5f001d |
eaa518ac |
Deciphered plaintext = eedba521 6d8f4b15

94 |
INTERNET SECURITY |
Example 3.16 |
Consider RC5-32/16/10. Since w = 32-bit words, r = 16 rounds and |
b = 10-byte key, the parameters to compute are u = w/8 = 4 bytes/word, c = b/u = 3 words in key, and t = 2(r + 1) = 34 words in S.
Key mixing
S[0] = ce9e9457 S[4] = 12f39eef S[8] = 0f1e2ae7 S[12] = f67fd8f0 S[16] = 4516534e S[20] = 3e10bde0 S[24] = a1d40dae S[28] = e820a877 S[32] = 7f05f007
S[1] = 9b2aa851 S[5] = 66ba64e2 S[9] = ae384da7 S[13] = 8ddf1681 S[17] = 82472626 S[21] = 4215fa75 S[25] = 8ef11ef1 S[29] = 1899687c S[33] = eef913ed
S[2] = 37cde42b S[6] = aec49188 S[10] = 9ad0a8ed S[14] = 3a7c135e S[18] = 383c9ba7 S[22] = f8dfa01c S[26] = d4409560 S[30] = 011db658
S[3] = c74caeb7 S[7] = 4699fa2b S[11] = 31200c4f S[15] = 22d6c9ed S[19] = 1c2074e9 S[23] = cda35bac S[27] = 043199d0 S[31] = 72062f23
Encryption
Round |
A |
B |
|
|
|
0 |
bd7a3978 |
08b9f366 |
1 |
a8c06bd8 |
85ed284f |
2 |
b4bf3585 |
90fe1e28 |
3 |
eff03eac |
28a2421b |
4 |
cd58becc |
5e05cc06 |
5 |
722d5b91 |
604e64a0 |
6 |
08e31821 |
5f3a0f83 |
7 |
f944d070 |
02ca706b |
8 |
ba17322a |
f7542d09 |
9 |
be78e241 |
ae7a1379 |
10 |
ae30c3c2 |
43413d61 |
11 |
d3c39d63 |
51b85bc0 |
12 |
244fd451 |
ae140ae0 |
13 |
5e9c7411 |
02157ae0 |
14 |
44a9b768 |
d566f0c2 |
15 |
485ad502 |
e6f6c625 |
16 |
548854fc |
8a20fd1a |
|
Ciphertext = 548854fc |
8a20fd1a |
|
|
Decryption |
|
|
|
|
|
|
|
||
Round |
A |
B |
||
|
|
|
|
|
16 |
|
485ad502 |
e6f6c625 |
|
15 |
|
44a9b768 |
d566f0c2 |
|
14 |
|
5e9c7411 |
02157ae0 |
|
|
|
|
|
|
|
SYMMETRIC BLOCK CIPHERS |
95 |
|
|
|
|
|
Round |
A |
B |
|
|
|
|
|
13 |
244fd451 |
ae140ae0 |
|
12 |
d3c39d63 |
51b85bc0 |
|
11 |
ae30c3c2 |
43413d61 |
|
10 |
be78e241 |
ae7a1379 |
|
9 |
ba17332a |
f7542d09 |
|
8 |
f944d070 |
02ca706b |
|
7 |
08e31821 |
5f3a0f83 |
|
6 |
722d5b91 |
604e64a0 |
|
5 |
cd58becc |
5e05cc06 |
|
4 |
eff03eac |
28a2421b |
|
3 |
b4bf3585 |
90fe1e28 |
|
2 |
a8c06bd8 |
85ed284f |
|
1 |
bd7a3978 |
08b9f366 |
|
0 |
eedba521 |
6d8f4615 |
|
|
|
||
Plaintext (deciphered text) = eedba52 |
6d8f4b15 |
|
3.4 RC6 Algorithm
RC6 is an improvement to RC5, designed to meet the requirements of increased security and better performance. Like RC5, which was proposed in 1995, RC6 makes use of datadependent rotations. One new feature of RC6 is the use of four working registers instead of two. While RC5 is a fast block cipher, extending it to act on 128-bit blocks using two 64-bit working registers. RC6 is modified its design to use four 32-bit registers rather than two 64-bit registers. This has the advantage that it can be done two rotations per round rather than the one found in a half-round of RC5.
3.4.1Description of RC6
Like RC5, RC6 is a fully parameterised family of encryption algorithms. A version of RC6 is also specified as RC6-w/r/b where the word size is w bits, encryption consists of a number of rounds r, and b denotes the encryption key length in bytes.
RC6 was submitted to NIST for consideration as the new Advanced Encryption Standard (AES). Since the AES submission is targeted at w = 32 and r = 20, the parameter values specified as RC6-w/r are used as shorthand to refer to such versions. For all variants, RC6-w/r/b operates on four w-bit words using the following six basic operations:
a + b: Integer addition modulo 2w
a − b: Integer subtraction modulo 2w
a b: Bitwise exclusive-OR of w-bit words a × b: Integer multiplication modulo 2w
a <<< b: Rotate the w-bit word a to the left by the amount given by the least significant lg w bits of b
96 |
INTERNET SECURITY |
a >>> b: Rotate the w-bit word a to the right by the amount given by the least signifi cant lg w bits of b (where lg w denotes the base-two logarithm of w).
RC6 exploits data-dependent operations such that 32-bit integer multiplication is efficiently implemented on most processors. Integer multiplication is a very effective diffusion, and is used in RC6 to compute rotation amounts so that these amounts are dependent on all of the bits of another register. As a result, RC6 has much faster diffusion than RC5.
3.4.2Key Schedule
The key schedule of RC6-w/r/b is practically identical to that of RC5-w/r/b. In fact, the only difference is that in RC6-w/r/b, more words are derived from the user-supplied key for use during encryption and decryption.
The user supplies a key of b bytes, where 0 ≤ b ≤ 255. Sufficient zero bytes are appended to give a key length equal to a non-zero integral number of words; these key bytes are then loaded into an array of c w-bit words L[0], L[1], . . . , L[c − 1]. The number of w-bit words generated for additive round keys is 2r + 4, and these are stored in the array S[0, 1, . . . , 2r + 3].
The key schedule algorithm is as shown below.
Key Schedule for RC6-w/r/b
Input: User-supplied b byte key preloaded into the c-word array L[0, 1, . . . , c − 1] Number of rounds, r
Output: w-bit round keys S[0, 1, . . . , 2r + 3] Key expansion:
Definition of the magic constants
Pw = Odd((e − 2)2w)
Qw = Odd((φ − 2)2w)
where
e= 2.71828182 . . . (base of natural logarithms)
φ= 1.618033988 . . . (golden ratio)
Converting the secret key from bytes to words for i = b − 1 down to 0 do
L[i/u] = (L[i/u] <<< 8 + K[i]
Initialising the array S
S[0] = Pw
for i = 1 to 2r + 3 do
S[i] = S[i − 1] + Qw
SYMMETRIC BLOCK CIPHERS |
97 |
Mixing in the secret key S
A = B = i = j = 0
v = 3 × max{c, 2r + 4} for s = 1 to v do
{
A = S[i] = (S[i] + A + B) <<< 3
B = L[j ] = (L[j ] + A + B) <<< (A + B) i = (i + 1) mod (2r + 4)
j = (j + 1) mod c
}
3.4.3 Encryption
RC6 encryption works with four w-bit registers A, B, C and D which contain the initial input plaintext. The first byte of plaintext is placed in the least significant byte of A. The last byte of plaintext is placed into the most significant byte of D. The arrangement of (A, B, C, D) = (B, C, D, A) is like that of the paralleled assignment of values (bytes) on the right to the registers on the left, as shown in Figure 3.12.
The RC6 encryption algorithm is shown below:
Encryption with RC6-w/r/b
Input: Plaintext stored in four w-bit input registers A, B, C, D Number of rounds, r
w-bit round keys S[0, 1, . . . , 2r + 3] Output: Ciphertext stored in A, B, C, D
Procedure :B = B + S[0]
D = D + S[1] for i = 1 to r do
{
t = (B × (2B + 1)) <<< 1g w u = (D × (2D + 1)) <<< 1g w A = ((A t) <<< u) + S[2i]
C = ((C u) <<< t) + S[2i + 1]
(A, B, C, D) = (B, C, D, A)
}

98 |
INTERNET SECURITY |
A |
B |
C |
D |
|
|
S[0] |
S[1] |
|
|
|
|
|
t |
|
u |
|
f |
|
f |
|
lg w |
|
lg w |
|
|
|
|
|
|
|
Repeat for |
|
|
|
i rounds |
|
S[2i] |
|
S[2i + 1] |
S[2i + 2] |
S[2i + 3] |
|
A B C D
Figure 3.12 RC6-w/r/b encryption scheme.
A = A + S[2r + 2]
C = C + S[2r + 3]
Example 3.17 |
Consider RC6-w/r/b where w = 32, r = 20 and b = 16. Suppose the |
|||||||||||||||
plaintext and user key are given as follows. |
|
|
|
|
|
|
|
|
|
|||||||
Plaintext: 02 |
13 |
24 |
35 |
46 |
57 |
68 |
79 |
8a |
9b |
ac |
bd |
ce |
df |
e0 |
f1 |
|
Key: |
01 |
23 |
45 |
67 |
89 |
ab |
cd |
ef |
01 |
12 |
23 |
34 |
45 |
56 |
67 |
78 |
Key expansion
Parameters:
c = 4(number of words in key)
t = 44(number of words in S)
u = 4(number of bytes in word)
SYMMETRIC BLOCK CIPHERS |
99 |
Magic constants:
Pw = b7e15163
Qw = 9e377969
Converting the secret key from bytes to words:
L[0] = 67452301 |
|
L[1] = efcdab89 |
|
|
|
|
|
L[2] = 34231201 |
|
L[3] = 78675645 |
|
|
|
|
|
Mixing in the secret key S |
|
|
|
|
|||
S[0] = 05479d38 |
|
S[1] = e4a3e582 |
S[2] = fbcc7a4b |
S[3] = e878faa4 |
|||
S[4] = 8ed14980 |
|
S[5] = 5f5873fd |
S[6] = aec05ae6 |
S[7] = aafffe1d |
|||
S[8] = 6bf8b7e3 |
|
|
S[9] = 64e27682 |
S[10] = 23c4d46f |
S[11] = da521c4b |
||
S[12] = 662b9392 |
S[13] = c51ae971 |
S[14] = be84587a |
S[15] = 473c1481 |
||||
S[16] = ab246684 |
S[17] = b9770047 |
S[18] = 98327b6a |
S[19] = 529be229 |
||||
S[20] = b992809a |
S[21] = 79c1fa56 |
S[22] = 617cd18d |
S[23] = 1bcb9a08 |
||||
S[24] = 8babbbb3 |
S[25] = 0dd061bd |
S[26] = 8c1ec8a2 |
S[27] = 20f286d0 |
||||
S[28] = faf8eff4 |
|
|
S[29] = 46b87c92 |
S[30] = c5096b01 |
S[31] = dbdcc9b0 |
||
S[32] = d1b212b4 |
S[33] = dd0f3d38 |
S[34] = 27c02df3 |
S[35] = 0fb21526 |
||||
S[36] = 46e0faa6 |
S[37] = e9d9748f |
S[38] = e274fdcc |
S[39] = 09ae3f8e |
||||
S[40] = 95f85e40 |
S[41] = a9f90a40 |
S[42] = f0e51469 |
S[43] = 45f060d1 |
||||
Encryption |
|
|
|
|
|
|
|
Using Figure 3.12, compute the ciphertext of RC6-32/20/16. |
|
||||||
Initial value in each register: |
|
|
|
|
|||
A = 35241302 |
B = 7eaff47e |
|
|
|
|
||
C = bdac9b8a |
D = d684c550 |
|
|
|
|
||
Encryption process |
|
|
|
|
|
||
|
|
|
|
|
|
|
|
Round |
|
|
A |
B |
|
C |
D |
|
|
|
|
|
|
||
1 |
|
7eaff47e |
a17a48d4 |
d684c550 |
fdbc336a |
||
2 |
|
a17a48d4 |
Fd35085f |
fdbc336a |
8d81f7b9 |
||
3 |
|
fd35085f |
9300620e |
8d81f7b9 |
2d144999 |
||
4 |
|
9300620e |
5013ef46 |
|
2d144999 |
53caa736 |
|
5 |
|
5013ef46 |
8c83dd52 |
53caa736 |
ef7cbe5d |
||
6 |
|
8c83dd52 |
f8754ace |
|
ef7cbe5d |
8cc61508 |
|
7 |
|
f8754ace |
49dd0a20 |
8cc61508 |
0035d1db |
||
8 |
|
49dd0a20 |
662fc8cb |
|
0035d1db |
7e9553f1 |
|
9 |
|
662fc8cb |
8fde9634 |
|
7e9553f1 |
84ceecec |
|
10 |
|
8fde9634 |
Ce5ac268 |
84ceecec |
42aa5994 |
||
|
|
|
|
|
|
|
|