Wednesday, November 19, 2014

DES | DATA ENCRYPTION STANDARD

DES (DATA ENCRYPTION STANDARD)

This is a symmetric key algorithm.
Input is taken à 64 bits
Key is taken à 56 bits
Output is taken à 64 bits
In case of this symmetric key algorithm, the size of the output is either equal or lesser than the size of the input. Generally the size of the output is longer than the input.
16 rounds processing to get it done.
In 1976, a Professor from Santa Clara University Edward found Simplified DES to make a symmetric more simple.
Input à 5 bits
Key à10 bits
Output à 8 bits
P10 : Permutation applied on 10 bits
 P8 : Permutation applied on 8 bits
IP : Initial Permutation
Fk : Complex function
SW : Switch function
Ip-1 : Inverse of initial Permutation
Let’s try the exercise !
10 bit keyàp10àShiftàp8àShiftàp8
10 bit key = 1010000010
Step 1 à Apply  P10 on the 10 bit key
Given p10 =  3 5 2 7 4 10 1 9 8 6
#      = 1 2 3 4 5 6 7 8 9 10
Key = 1 0 1 0 0 0 0 0 1  0
Answer P10 à 10000 01100
Step 2 : Apply left circular shift separately on second 5 bit
1 0 0 0  0         0 1 1 0 0
1 2 3 4  5         1 2 3 4 5
Start from #2  which is 0 and 3rd which is 0 (reverse) and 4th is 0  and 5 which is 0 and 1 which 1
And the result will be 00001 and the rest also start from #2 so the result is 11000
Answer Shift à 0000111000
Step 3 à Apply p8 on the output step 2
Given P8 : 6 3 7 4 8 5 10 9
#      = 1 2 3 4 5 6 7 8 9 10
Key = 0 0 0 0 1 1 1 0 0 0
Answer P8 à 1 0 1 0 0  1 0 0  (k1 Subkey)
Step 4 à Apply left cecular  by 2 bits on output of step 2
0 0 0 0 1               1 1 0 0 0
1 2 3 4 5               1 2 3 4 5
Start from #2  which is 0 and 3rd which is 0 (reverse) and 4th is 0  and 5 which is 0 and 1 which 1
And the result will be 00100 and the rest also start from #2 so the result is 00011
Answe Shift
à 00100 00011 (k2)
Step 5 à Apply p8 on output of step 4
Given p8 : 6 3 7 4 8 5 10 9
#      = 1 2 3 4 5 6 7 8 9 10
Key = 0 0 1 0 0 0 0 0 1  1
Final Cipher text à 0 1 0 0 0 0 1

Encryption
8 bits Plain text à IPà FKàSWàFKàIP à 8 bits Cipher text
Suppose : PT : 1011101
Step 1 : Initial Permutation
Given à 2 6 3 1 4 8 5 7
#      = 1 2 3 4 5 6 7 8
Key = 1 0 1 1 1 1 0 1
Answer p8 à 0 1 1 1 1 1 1 0
Step 2 : Complex function is combination of substitution and permutation.
0 1 1 1                   1 1 1 0
    L                            R
Fk (L1R) = L + F (R,SK),R)
Where + is Exclusive OR
F  is Mapping Function
R is Right side
SK is Subkey à K1
L is left side
Let’s see the result k1 and k2 in previous steps
K1 : 10100100
K2 : 01000011
Suppose output of F (1110,10100100) = 1101
L = 0111
Fk (0111,1110)=(0111+1101,1110)

XOR
0 1 1 1
1 1 0 1
1 0 1 0   à output
Fk = ( 1010,  1110)
             L         R
Step 3 à Switch function
 ( the left L is shifted to R and R is shifted to L / interchanging of L&R)
( 1010,  1110)
    R         L
Step 4 : Complec funcion
Fk (1110,1010)= (1110+F (1010,01000011),1010)
Fk(1010,01000011)= 1100
Fk(1110,1010)=(1110+1100,1010)
                       = (0010,1010)
XOR
1 1 1 0
1 1 0 0
0 0 1 0
Step 5 : Apply IP-1 to output of step 4
Geven : 4 1  3 5 7 2 8 6
#      = 1 2 3 4 5 6 7 8
Key = 0 0 1 0 1 0 1 0

Final Cipher text à 0 0 1 1 1 0 0 0

No comments:

Post a Comment