You are on page 1of 20

Lecture 06 – Cryptography:

Part IV
Week 06. Security in Computing
Revision
• Understood the key-generation algorithm for SDES algorithm.
• Learnt about the encryption algorithm for the SDES algorithm.

Cryptography: Part IV November 7, 2020 | 2


The DES algorithm
• In DES, data are encrypted in a 64-bit block using a 56-bit key.
• The algorithm transforms the 64-bit input, using a series of steps into a 64-bit output.
• There are 16 rounds in DES.
• The same steps with the same keys are used to reverse the encryption.
• As with any encryption scheme, there are two inputs to the encryption function, the plaintext must be 64 bits in
length and the key 56 bits in length.

Cryptography: Part IV November 7, 2020 | 3


The key generation steps
Step 1. Apply PC1 (Permutated choice table 1) to get 56-bit key from 64 bit key.

Step 2. Perform LS1 (Left circular shift 1) on the 28-bit halves separately.

Step 3. Apply PC2 (Permutated choice table 2) to get a 48-bit key K1 (ROUND KEY 1) from the 56-bit key.

Cryptography: Part IV November 7, 2020 | 4


DES Encryption
Step 1. Apply IP for 64 bits of the Plain Text.
Step 2. The left-most 32-bits are referred to as Lo and the right-most 32-bits are referred to as Ro.
Step 3. Apply Expansion and Permutation (EP) on Ro to get 48-bits output of E(Ro).
Step 4. Calculate A = E(Ro) xor K1 to get 48 bits output which will be the input for S-Boxes.
Step 5. The first 6 bits of A are input for S1 box, the second 6 bits of A are input for S2 box and so on until S8 box.
Step 6. Concatenate the output of S-Boxes which is of 32 bits (B).
Step 7. Apply permutation function to get P(B).
Step 8. Calculate R1 = P(B) xor Lo.
Step 9. Ciphertext for Round 2 is (Ro, R1).

Cryptography: Part IV November 7, 2020 | 5


Strengths of DES algorithm
• The Avalanche Effect:
• A desirable property of any encryption algorithm is that a small change in either the plaintext or the key should produce a
significant change in the ciphertext.
• A change in 1 bit of the plaintext or the key must produce a change in many bits of the ciphertext.

• The Key Size:


• With a key length of 56 bits, there are 2^56 possible keys, which approximates to 7.2 x 10^16 keys. Thus, brute force attacks
appears to be impractical.

Cryptography: Part IV November 7, 2020 | 6


DES – An example
• This problem provides a numerical example of encryption using a one-round version of DES.
• We start with the same bit pattern for the key and the plaintext, namely:

• Key K In hexadecimal notation 1024D53719ABCD1C


• Plain text T in hexadecimal notation A E C C B A 0 8 5 9 5 4 C 6 0 8

Cryptography: Part IV November 7, 2020 | 7


DES – An example
a. Derive K1 , the first-round sub key.
b. Derive , Lo, Ro.
c. Expand Ro to get E[Ro] , where E[ ] is the expansion function
d. Calculate A = E[Ro] xor K1.
e. Group the 48-bit result of (d) into sets of 6 bits and evaluate the corresponding S-box substitutions.
f. Concatenate the results of (e) to get a 32-bit result, B.
g. Apply the permutation to get P(B).
h. Calculate R1 = P(B) xor Lo.
i. Write down the cipher text.

Cryptography: Part IV November 7, 2020 | 8


DES – An example
Writing the HEX keys K in binary we have,

1 = 0001 0 = 0000 2 = 0010 4 = 0100 D = 1101 5 = 0101


3 = 0011 7 = 0111 1 = 0001 9 = 1001 A = 1010 B = 1011
C = 1100 D = 1101 1 = 0001 C = 1100
Here,
On applying PC-1:

Cryptography: Part IV November 7, 2020 | 9


DES – An example
We have,
0110010001000100001010101001
0010100011001110111100001101

Now, separately applying LS-1 on both the halves, we have,


1100100010001000010101010010
0101000110011101111000011010

Now, applying PC-2, we get Key K1 which is:

Cryptography: Part IV November 7, 2020 | 10


DES – An example
K1 = 000111
000000
000000
001111
110111
110100
100001
110101

Cryptography: Part IV November 7, 2020 | 11


DES – An example
Now coming over to the Plain text, to derive Lo and Ro,

Converting the plain text HEX into their respective binary format,
A = 1010 E = 1110 C = 1100 C = 1100 B = 1011 A = 1010
0 = 0000 8 = 1000 5 = 0101 9 = 1001 5 = 0101 4 = 0100
C = 1100 6 = 0110 0 = 0000 8 = 1000

Now, applying IP, we have,

Lo = 01110010 00110100 01100011 00010000


Ro = 01000111 00000101 10011111 01000101

Cryptography: Part IV November 7, 2020 | 12


DES – An example
Now, expanding Ro to get E (Ro) by using the expansion permutation, we have,

E (Ro) = 101000
001110
100000
001011
110011
111110
101000
001010

Cryptography: Part IV November 7, 2020 | 13


DES – An example
Now, calculating A = E (Ro) xor K1.
Here,
101000 001110 100000 001011 110011 111110
000111 000000 000000 001111 110111 110100
101111 001110 100000 000100 000100 001010

101000 001010
100001 110101
001001 111111

Cryptography: Part IV November 7, 2020 | 14


DES – An example
• Now, initializing s-box substitutions,

Cryptography: Part IV November 7, 2020 | 15


DES – An example

Cryptography: Part IV November 7, 2020 | 16


DES – An example
• We have,

Cryptography: Part IV November 7, 2020 | 17


DES – An example
Now, concatenating the results from the results of the S-boxes, we have,
B = 0111 0100 1101 1110 0100 0010 0100 1011

now, applying P (B), we get,

P (B) = 00001100 01110111 10011011 01010010

Cryptography: Part IV November 7, 2020 | 18


DES – An example
now, calculating R1 = Lo xor P (B)

now, the value for the next round of DES is equal to (Ro, R1), which is,
(Ro, R1) = 0100 0111 0000 0101 1001 1111 0100 0101 0111 1110 0100 0011 1111 1000 0100 0010
=47059F457E43F842

Cryptography: Part IV November 7, 2020 | 19


Summary
• Understood how the DES algorithm differentiates from the SDES algorithm with 64-bit block and 56-bit key.
• Analyzed a single round of the DES algorithm.

Cryptography: Part IV November 7, 2020 | 20

You might also like