Cryptography Reference
In-Depth Information
The RC5 Algorithm
The algorithm depends on three parameters:
- the word size,
w
, in bits (in the following written as '
w
=
32');
- the number of rounds,
r(r
≤
1
)
; and
- the key length of
b
bytes (
b
=
0
,
1
,...,
255).
Plaintext and ciphertext blocks are each 2
w
bits long, for
w
=
32, i.e., 64 bits. Rivest
recommends a key length of 16 bytes for
w
=
32 with 12 rounds, and denotes the
method as 'RC5-32/12/16'.
Encryption
•
From a key
K
of length
b
, create a field,
S
0
,S
1
,...,S
2
r
+
1
,of2
(r
+
1
)
subkeys
with 32 bits each (see below).
•
Decompose every plaintext block into two 32-bit blocks,
A
and
B
.
•
Set
A=A+S
0
B=B+S
1
•
In the
i
th round (
i
=
1
,...,r)
set
⊕
A = ((A
B) <<< B) + S
2i
⊕
B = ((B
A) <<< A) + S
2i
+
1
where
A <<< B
denotes the left rotation of
A
by
B
bits. Since the left
rotation by 32 bits is the identity for
w
=
32, you have to consider only the
five least significant bits of
B
for computing
A <<< B
.
Decryption
Decryption proceeds accordingly in the opposite direction:
•
Decompose the ciphertext block into two half blocks,
A
and
B
, with 32 bits
each.
Figure 5.12:
The RC5 algorithm.