Hi!, for this week we need to choose a block cipher to investigate and also put an example, so, I chose RC5, is a block cipher quick and easy, designed by Ronald Rivest in 1995 in the MIT's Laboratory of Computer Science, this encryption algorithm, works for hardware and software, use as a parameters the length of the word, the number of iterations and the length of the private key.
RC5 has the following characteristics:
- Is a symmetric cipher, both the encryption and decryption uses the same private key.
- It works in both, hardware and software because RC5 uses only elementary operations.
- Is adaptable to processors with different word lengths, for example, if we have a 64-bit processor, RC5 can use the entire length of the word.
- Has an iterative structure with a variable number of iterations.
- Has a cryptographic key variable length, this allows that the user can choose the desired level of security for your application and solves problems related to the export of cryptographic algorithms that use more than 40 bits keys.
- It is easy to implement.
- A request has limited memory, so it can be easily implement on devices with small memory.
- Provides a high safety
- Using data-dependent rotations, in which words are rotated cyclically.
One of the fundamental characteristics of RC5 is that uses three parameters, W, R, B, if two users exchange messages using RC5 for encryption must agree with that parameters.
- W: is the word length in bits. RC5 uses basically values such as 16, 32 and 64 in W, We need to know that RC5 cipher blocks of 2 words use the plaintext and the ciphertext uses 2W bits. so if we have a W = 32, the blocks of plaintext and ciphetext are of 64 bits.
- R: represents the number of iterations of the algorithm and varies from 0 to 255. the security level of the cipher depends from this parameter: the larger choose R, the better the security.
- B: is the length of the private key K. Allowed values of b are 0, 1, …, 255.
For convenience, we can use RC5-W/R/B to denote those parameters, for example, the algorithm RC5-32/16/10 uses 32-bits words, leaving 16 iterations of the algorithm and has a key of 80 bits (10 bytes). Not necessarily all the parameters must be specified. We can omitted the last parameter or can be omitted the last two. For example, with RC5-32, is indicated the RC5 algorithm that uses 32-bits words, without any reference to the number of iterations and the length of the key.
- Sum of words module W/8, this operation is denoted by +, the inverse operation, subtraction, is denoted by -.
- Bitwise exclusive-OR, denoted XOR (The reverse is itself).
- Rotation to the left of words. The cyclical rotation of the word x of y bits to the left is denoted with 2^w y is considered the modulo w, so when w is a power of two, are need only x << y low order bits of y to determine the number of position to rotate. the reverse operation is to the right.
These operations are supported efficiently by many processors, the main feature of RC5 is the use of data-dependent rotations, rotations dependent on the plaintext and the key, also, the rotations are the only nonlinear operator in RC5.
- Key expansion algorithm
- Encryption algorithm
- Decryption algorithm
Qw = ODD((phi-1)2^w)
- Pw 16-bit = B7 E1
- Pw 32-bit = B7 E1 51 63
- Pw 64-bit = B7 E1 51 62 8A ED 2A 6B
- Qw 16-bit = 9E 37
- Qw 32-bit = 9E 37 79 B9
- Qw 64-bit = 9E 37 79 B9 7F 4A 7C 15
S[0] = Pw
for i = 1 to 2r+1 do
S[i] = S[i-1]+Qw
X , Y = 0
i, j = 0
do 3*max(x, 2r+1) times:
X = S[i] = (S[i]+X+Y) << 3
Y = L[j] = (L[j]+X+Y) << (X+Y)
i = (i+1) mod (2r+1)
j = (j+1) mod c
A = A + S[0]
B = B + S[1]
for i = 1 to r do:
A = ((A XOR B) << B) + S[2i]
B = ((B XOR A) << A) + S[2i+1]
for i = r downto 1 do:
B = ((B-2[2*i+1] >> A) XOR A
A = ((A - S[2i]) >> B) XOR B
B = B - S[1]
A = A - S[0]
I tried to understand the vulnerabilities of the RC5, I saw that if we have two similar plaintext blocks can give us results very similar, so I put the example about that:
This is first iteration and we already have the table expansion.
A = A XOR B
A = A << B
A = A + S[i]
B = B XOR A
B = B << A
B = B + S[i+1]
A = 11111101100001001101111001100011
B = 10110001100110011010111100110001
Now, we can made the first 3 steps.
A = A XOR B
A =
11111101100001001101111001100011 XOR
10110001100110011010111100110001
---------------------------------------------------------
11001100000111010111000101010010
A = 11001100000111010111000101010010
A = 11111101100001001101111001100011 << 10110001100110011010111100110001
A = 11100010101001011001100000111010
A = A + S[i]
A =
11100010101001011001100000111010
+ 01110001100111101110010011011001
--------------------------------------------------------
01110001000001011011001101100001
A = 1110001000001011011001101100001
Then, imagine that we have a A and B just only one letter different.
A = 11111101100001001101111001100011
B = 00110001100110011010111100110001
Now, we can made the next 3 steps.
A = A XOR B
A = 11111101100001001101111001100011 XOR
00110001100110011010111100110001
-----------------------------------------------------------
11001100000111010111000101010010
A = A << B
A = 11001100000111010111000101010010 << 00110001100110011010111100110001
A = 11100010101001011001100000111010
A = A + S[i]
A = 11100010101001011001100000111010
+ 01110001100111101110010011011001
----------------------------------------------------------
001110001000001101011001101100001
A = 1110001000001101011001101100001
Now, compare A.
A_1 = 1110001000001011011001101100001
A_2 = 1110001000001101011001101100001
You can see that we have two plaintext blocks very similar, if we have the ciphertext very similar, we have a problem because an attacker can see that ciphertext blocks and check similarities to have things for the plain text.
So it is important to know that we have issues that involves vulnerabilities but we can improve put, as I explain in the algorithm, put a lager R that represents the number of iterations of the algorithm and varies from 0 to 255. the security level of the cipher depends from this parameter: the larger choose R, the better the security.
Bibliography.
* The RC5 Encryption Algorithm MIT, Ronald Rivest link
Ortografía... Lo de vulnerabilidades quedó algo débil, pero estando en inglés semidecente aún así vale 7.
ResponderEliminar