[go: up one dir, main page]

0% found this document useful (0 votes)
42 views3 pages

Simpli Ed DES 1: 2.1 Key Generation

Download as doc, pdf, or txt
Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1/ 3

ISE334/SE425: E-Commerce, Com., and Info.

Security Recitation 3
Semester 2 5774 12 March 2014

Simpli ed DES

1 Introduction
In this lab we will work through a simpli ed version of the DES algorithm. The algorithm is not crypto-
graphically secure, but its operations are similar enough to the DES operation to give a better feeling for
how it works.
We will proceed by reading the Simpli ed DES algorithm description in the Stallings section. We will
then work through a full example in class.

2 Full Example
Let the plaintext be the string 0010 1000. Let the 10 bit key be 1100011110.

2.1 Key Generation


The keys k1 and k2 are derived using the functions P 10, Shift, and P 8.
P 10 is de ned as follows:
P10
3 5 2 7 4 10 1 9 8 6

P 8 is de ned to be as follows:
P8
6 3 7 4 8 5 10 9
The rst key k1 is therefore equal to:
Bit # 1 2 3 4 5 6 7 8 9 10
K 1 1 0 0 0 1 1 1 1 0
P 10(K) 0 0 1 1 0 0 1 1 1 1
Shift(P 10(K)) 0 1 1 0 0 1 1 1 1 0
P 8(Shift(P 10(K))) 1 1 1 0 1 0 0 1
The second key k2 is derived in a similar manner:
Bit # 1 2 3 4 5 6 7 8 9 10
K 1 1 0 0 0 1 1 1 1 0
P 10(K) 0 0 1 1 0 0 1 1 1 1
3
Shift (P 10(K))) 1 0 0 0 1 1 1 0 1 1
2
P 8(Shift (P 10(K))) 1 0 1 0 0 1 1 1

So we have the two keys k1 = f1110 1001g and k2 = f1010 0111g

2.2 Initial and Final Permutation


The plaintext undergoes an initial permutation when it enters the encryption function, IP . It undergoes a
1
reverse nal permutation at the end IP .
The function IP is de ned as follows:

1
IP
2 6 3 1 4 8 5 7
The function IP 1 is de ned as follows:

IP 1
4 1 3 5 7 2 8 6
Applied to the input, we have the following after the initial permutation:
Bit # 1 2 3 4 5 6 7 8
P 0 0 1 0 1 0 0 0
IP(P) 0 0 1 0 0 0 1 0

2.3 Functions fK, SW , K


The function fk is de ned as follows. Let P = (L; R), then fK(L; R) = (L F (R; SK); R).

The function SW just switches the two halves of the plaintext, so SW (L; R) ! (R; L)
The function F (p; k) takes a four bit string p and eight bit key k and produces a four bit output. It
performs the following steps.

1. First it runs an expansion permutation E=P :


E/P
4 1 2 3 2 3 4 1
2. Then it XORs the key with the result of the E=P function
3. Then it substitutes the two halves based on the S-Boxes.
4. Finally, the output from the S-Boxes undergoes the P 4 permutation: P4
2431
1
Applying the functions, we must perform the following steps: IP f K2 SW fK1 IP

1. We have already calculated IP (P ) = f0010 0010g. Applying the next functions:

2. fK1 (L; R) = ff1110 1001g(0010 0010) = (0010 F (0010; f1110 1001g); 0010)
3. F (0010; f1110 1001g) = P 4 SBoxes f1110 1001g (E=P (0010))
4. The steps are:
Bit # 1 2 3 4 5 6 7 8
R 0010
E/P(R) 0 0 0 1 0 1 0 0
k
1 1 1 1 0 1 0 0 1
E/P(R) k1 1 1 1 1 1 1 0 1
SBoxes(E/P(R) k1) 1000
P4(Sboxes(E/P(R) k1)) 0 0 0 1

5. The result from F is therefore 0001

6. Calculating we then have fk1 (L; R) = (0010 0001; 0010) = (0011; 0010)

7. So far, then L = 0011 and R = 0010. SW just swaps them so R = 0011 and L = 0010.

8. We now do the calculation of fk2 (L; R) = ff1010 0111g(0010 0011) = (0010 F (0011; f1010 0111g; 0011))

2
9. The steps for F are as above:
Bit # 1 2 3 4 5 6 7 8
R 0011
E/P(R) 1 0 0 1 0 1 1 0
k2 1 0 1 0 0 1 1 1
E/P(R) k2 0 0 1 1 0 0 0 1
SBoxes(E/P(R) k2) 1010
P4(Sboxes(E/P(R) k2)) 0 0 1 1
10.So now we have the outcome of F as 0011
11.Calculating we then have fk2 (L; R) = (0010 0011; 0011) = (0001; 0011)

12.Last, we perform the IP 1


permutation:
Bit # 1 2 3 4 5 6 7 8
R,L 0 0 0 1 0 0 1 1
1
IP (R,L) 1 0 0 0 1 0 1 0
13.So the nal result of the encryption is 1000 1010.

You might also like