Unit 2 (RC 5)
Unit 2 (RC 5)
RC4 was designed by Ron Rivest of RSA Security in 1987. The official name for this
algorithm is “Rivest Cipher 4”.
RC4 is a stream cipher.
RC4 was initially kept secret.
RC4 has become part of some widely used encryption techniques and standards, including
WEP and WPA for wireless cards and TLS. What has made its wide deployment possible is
its speed and simplicity of design. Implementations in both software and hardware are
possible. RC4 does not consume many resources.
RC5
RC5 is a symmetric-key block-encryption algorithm developed by Ron Rivest in 1994. It is
part of the RC series of encryption algorithms, which includes RC2, RC4, and RC6, all
developed by Ron Rivest.
The main features of RC5 are that it is quite fast as it uses only the primitive computer
operations (such as addition, XOR, shift, etc).
It was designed as a candidate for the Advanced Encryption Standard (AES) competition,
which aimed to select a new encryption standard to replace the aging Data Encryption
Standard (DES). Ultimately, the Rijndael algorithm was selected as AES, but RC-5 remains
a notable encryption algorithm.
It allows for a variable number of rounds, and a variable bit-size key to add to the
flexibility.
RC5 requires less memory for execution, and is therefore, suitable not only for desktop
computers, but also for smart cards and other devices that have a small memory capacity.
It has been incorporated into the RSA Data Security Incorporation’s products such as
BSAFE, JSAFE and S/MAIL.
How RC5 Works
In RC5, the word size (i.e. input plain-text block size), number of rounds and number of 8-
bit bytes (octets) of the key, all can be of variable length.
RC-5
The output resulting from RC5 is the cipher text, which has the same size as the
input plain text.
Since RC5 allows for variable values in the three parameters, as specified, a
particular instance of the RC5 algorithm is denoted as:
RC5-w/r/b, where w = word size in bits, r = number of rounds, b = number of 8-bit
bytes in the key.
Thus, if we have RC5-32/16/16, it means that we are using RC5 with a block size of
64 bits (remember that RC5 uses 2-word blocks), 16 rounds of encryption, and 16
bytes (i.e. 128 bits) in the key.
Rivest has suggested RC5-32/12/16 as the minimum safety version.
Components of RC-5
2. Principles of Operation
There is one initial operation consisting of two steps , then a number of rounds.
The number of rounds (r) can vary from 0 to 255.
For simplicity, we shall assume that we are working on an input plain block with size 64
bits. The same principles operation will apply to other block sizes, in general.
In the first two steps of the one-time initial operation, the input plain text is divided into
two 32-bit blocks A and B.
The first two sub-keys S[0] and S[1] are added to A and B, respectively. This produces C
and D respectively, and marks the end of the one-time operation.
Then, the rounds begin. In each round, there are following operations:
● Bitwise XOR ● Left circular-shift ● Addition with the next sub-key, for both C and
D.
This is the addition operation first, and then the result of the addition mod
performed.
3. One-time Initial Operation
In the subkey mixing stage, the subkeys S[0], S[1], … are mixed with the sub-portions of the
original key, i.e. L[0], L[1], … L[c]. Note that c is the last sub-key position in the original key.
Key Expansion :
RC5 performs a complex set of operations on the secret key to produce a total of t
subkeys. Two subkeys are used in each round, and two subkeys are used on an additional
operation that is not part of any round, so t = 2r + 2.
Each subkey is one Word (w bits) in length.
The subkeys are stored in a t-word array labeled S[0], S[1], ….,‘ S[t-1]. Using the
parameters r and w as inputs, this array is initialized to a particular fixed pseudorandom bit
pattern.
Then the b-byte key, K[0…. b - 1], is converted into a c-word array L[0…. c -1]. On a little
endian machine, this is accomplished by zeroing out the array L and copying the string K
directly into the memory positions represented by L.
If b is not an integer multiple of w, then a portion of L at the right end remains zero.
Finally, a mixing operation is performed that applies the contents of L to the initialized
value of S to produce a final value for the array S.
The initialize operation makes use of two word-length constants defined as follows: