RFC 2268 (rfc2268) - Page 2 of 11
A Description of the RC2(r) Encryption Algorithm
Alternative Format: Original Text Document
RFC 2268 RC2(r) Encryption Algorithm March 1998 Encryption. This takes a 64-bit input quantity stored in words R[0], ..., R[3] and encrypts it "in place" (the result is left in R[0], ..., R[3]). Decryption. The inverse operation to encryption. 2. Key expansion Since we will be dealing with eight-bit byte operations as well as 16-bit word operations, we will use two alternative notations for referring to the key buffer: For word operations, we will refer to the positions of the buffer as K[0], ..., K[63]; each K[i] is a 16-bit word. For byte operations, we will refer to the key buffer as L[0], ..., L[127]; each L[i] is an eight-bit byte. These are alternative views of the same data buffer. At all times it will be true that K[i] = L[2*i] + 256*L[2*i+1]. (Note that the low-order byte of each K word is given before the high-order byte.) We will assume that exactly T bytes of key are supplied, for some T in the range 1 <= T <= 128. (Our current implementation uses T = 8.) However, regardless of T, the algorithm has a maximum effective key length in bits, denoted T1. That is, the search space is 2^(8*T), or 2^T1, whichever is smaller. The purpose of the key-expansion algorithm is to modify the key buffer so that each bit of the expanded key depends in a complicated way on every bit of the supplied input key. The key expansion algorithm begins by placing the supplied T-byte key into bytes L[0], ..., L[T-1] of the key buffer. The key expansion algorithm then computes the effective key length in bytes T8 and a mask TM based on the effective key length in bits T1. It uses the following operations: T8 = (T1+7)/8; TM = 255 MOD 2^(8 + T1 - 8*T8); Thus TM has its 8 - (8*T8 - T1) least significant bits set. Rivest Informational



