RFC 2268 (rfc2268) - Page 3 of 11
A Description of the RC2(r) Encryption Algorithm
Alternative Format: Original Text Document
RFC 2268 RC2(r) Encryption Algorithm March 1998
For example, with an effective key length of 64 bits, T1 = 64, T8 = 8
and TM = 0xff. With an effective key length of 63 bits, T1 = 63, T8
= 8 and TM = 0x7f.
Here PITABLE[0], ..., PITABLE[255] is an array of "random" bytes
based on the digits of PI = 3.14159... . More precisely, the array
PITABLE is a random permutation of the values 0, ..., 255. Here is
the PITABLE in hexadecimal notation:
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: d9 78 f9 c4 19 dd b5 ed 28 e9 fd 79 4a a0 d8 9d
10: c6 7e 37 83 2b 76 53 8e 62 4c 64 88 44 8b fb a2
20: 17 9a 59 f5 87 b3 4f 13 61 45 6d 8d 09 81 7d 32
30: bd 8f 40 eb 86 b7 7b 0b f0 95 21 22 5c 6b 4e 82
40: 54 d6 65 93 ce 60 b2 1c 73 56 c0 14 a7 8c f1 dc
50: 12 75 ca 1f 3b be e4 d1 42 3d d4 30 a3 3c b6 26
60: 6f bf 0e da 46 69 07 57 27 f2 1d 9b bc 94 43 03
70: f8 11 c7 f6 90 ef 3e e7 06 c3 d5 2f c8 66 1e d7
80: 08 e8 ea de 80 52 ee f7 84 aa 72 ac 35 4d 6a 2a
90: 96 1a d2 71 5a 15 49 74 4b 9f d0 5e 04 18 a4 ec
a0: c2 e0 41 6e 0f 51 cb cc 24 91 af 50 a1 f4 70 39
b0: 99 7c 3a 85 23 b8 b4 7a fc 02 36 5b 25 55 97 31
c0: 2d 5d fa 98 e3 8a 92 ae 05 df 29 10 67 6c ba c9
d0: d3 00 e6 cf e1 9e a8 2c 63 16 01 3f 58 e2 89 a9
e0: 0d 38 34 1b ab 33 ff b0 bb 48 0c 5f b9 b1 cd 2e
f0: c5 f3 db 47 e5 a5 9c 77 0a a6 20 68 fe 7f c1 ad
The key expansion operation consists of the following two loops and
intermediate step:
for i = T, T+1, ..., 127 do
L[i] = PITABLE[L[i-1] + L[i-T]];
L[128-T8] = PITABLE[L[128-T8] & TM];
for i = 127-T8, ..., 0 do
L[i] = PITABLE[L[i+1] XOR L[i+T8]];
(In the first loop, the addition of L[i-1] and L[i-T] is performed
modulo 256.)
The "effective key" consists of the values L[128-T8],..., L[127].
The intermediate step's bitwise "and" operation reduces the search
space for L[128-T8] so that the effective number of key bits is T1.
The expanded key depends only on the effective key bits, regardless
Rivest Informational