UNIT II
Block Ciphers & Public Key Cryptography
Data Encryption Standard -Block cipher principles-block cipher modes of operation- Advanced Encryption
Standard (AES)-Triple DES-Blowfish-RC5 algorithm. Public key cryptography: Principles of public key
cryptosystems-The RSA algorithm-Key management - Diffie Hellman Key exchange-Elliptic curve arithmetic-
Elliptic curve cryptography
RC5Algorithm
What is RC5?
RC5 is a block cipher notable for its simplicity.
Designed by Ronald Rivest in 1994.
RC stands for "Rivest Cipher", or alternatively, "Ron's Code.
CS6701 / Unit 2 / RC5Algorithm
Features
Symmetric block cipher
Same Key for encryption and decryption
Suitable for hardware and software
It uses only computational primitive operations commonly found on typical
microprocessors
Fast
Simple
Adaptable to processors of different word lengths
Variable number of rounds
Variable length cryptographic key
Low memory requirements
Data – Dependent Rotations
CS6701 / Unit 2 / RC5Algorithm
Parameterization
RC5 algorithm example: RC5-32/16/7
similar to DES
Two 32-bit word inputs and outputs
16 rounds
7-byte(56-bit) secret key
Choices for w and r
speed vs. security
Choosing larger number of rounds provides an increased level of security
Examples
RC5-32 Means 32/12/7
RC5-32, 9 Means 32/9/ 7
RC5-64 Means 64/16/7
CS6701 / Unit 2 / RC5Algorithm
Primitive Operations of RC5
• 2’s complement • Bitwise Exclusive OR • Left Rotation of words
addition of words of words • Inverse – Right
• Inverse operation Rotation
subtraction • Cyclic rotations
Modulo 2w
XOR Rotation
addition
CS6701 / Unit 2 / RC5Algorithm
RC5 Algorithm
CS6701 / Unit 2 / RC5Algorithm
RC5 Encryption
A =A + S[0];
B = B + S[1];
for i = 1 to r do
A = ((A ⊕B) <<< B) + S[2*i];
B = ((B ⊕A) <<<A) + S[2*i + 1];
CS6701 / Unit 2 / RC5Algorithm
RC5 Decryption
for i = r downto 1 do
B = ((B - S[2*i +1]) >>>A) ⊕A;
A = ((A - S[2*i]) >>> B) ⊕B;
B = B - S[1];
A =A - S[0];
CS6701 / Unit 2 / RC5Algorithm
RC5 Key Expansion
RC5 performs some operations on the secret key to generate a total of t
sub keys, which are stored in S array, S[0],S[1], …, S[t-1]
The key expansion algorithm consists of two constants (Magic numbers)
and three simple algorithm parts
Step-1: Convert secret key bytes to words
Step-2: Initialize sub key array S (S[0], S[1], …, S[t-1])
Step-3: Mix the secret key into sub key array S
CS6701 / Unit 2 / RC5Algorithm
Key Expansion
CS6701 / Unit 2 / RC5Algorithm
Magic Constant
In key expansion, magic constants are used
Pw = Odd((e - 2)2w);
e=2.718281828…. (base of natural logarithms)
Qw = Odd((f - 1)2w);
f=1.618033988…. (golden ratio = (1+sqr(5))/2)
Odd(x): odd integer nearest to x
Example
CS6701 / Unit 2 / RC5Algorithm
Key Expansion
Step-1: Convert secret key bytes to words
Copy the Key into new array L ofWords with size equal c
Any unfilled byte positions of L are zeroed
c=[b/4] for 32 bit word
In case b = c = 0 we reset c =1 and set L[0] = 0
CS6701 / Unit 2 / RC5Algorithm
Key Expansion
Step-2: Initialize sub key array S (S[0], S[1], …, S[t-1]
create an expanded key table, S[0...t-1]
has t entries, t = 2(r + 1) w-bit words
Initialize array S
S[0] = Pw;
for i = 1 to t - 1 do
S[i] = S[i - 1] + Qw;
CS6701 / Unit 2 / RC5Algorithm
Key Expansion
Step-3: Mix the secret key into sub key array S
Mix the secret key into table, S
i = j = 0;A = B = 0;
do 3 * max(t, c) times:
A = S[i] = (S[i] + A + B) <<< 3;
B = L[j] = (L[j] + A + B) <<< (A + B);
i = (i + 1) mod(t);
j = (j + 1) mod(c);
CS6701 / Unit 2 / RC5Algorithm
Security of RC5
Exhaustive Search
Differential cryptanalysis
Linear cryptanalysis
Timing Attacks
CS6701 / Unit 2 / RC5Algorithm
Exhaustive Search
RC5-32/r/b allows
a maximum of 2040 secret key bits
a maximum of 25(2r + 2) expanded key table bits
Choosing large values for r and b can prevent exhaustive attacks
Differential and Linear Cryptanalysis
CS6701 / Unit 2 / RC5Algorithm
Timing Attack
Developed by Kocher
The opponent can obtain some information about the secret key by
recording and analyzing the time used for cryptographic operations that
involve the key.
Kocher found that RC5 may be subject toTiming attack if RC5 is
implemented on platforms for which the time for computing a single
rotation is proportional to the rotation amount
RC5 can easily implemented to make the total time is data-independent
(ex by computing the rotation of t bits using left-shift of t bits and right
shift of w-t bits)
CS6701 / Unit 2 / RC5Algorithm
ThankYou
CS6701 / Unit 2 / RC5Algorithm