Lecture 3 - Data Encryption Standard
Lecture 3 - Data Encryption Standard
Chapter 4
Block Ciphers and the Data
Encryption Standard
P10(k1,k2,k3,k4,k5,k6,k7,k8,k9,k10)=(k3,k5,k2,k7,k4,k10,k1,k9,k8,k6)
LS-1(k1,k2,k3,k4,k5)=(k2,k3,k4,k5,k1)
P8(k1,k2,k3,k4,k5,k6,k7,k8,k9,k10)=(k6,k3,k7,k4,k8,k5,k10,k9)
LS-2(LS-1(k1,k2,k3,k4,k5)=LS-2(k2,k3,k4,k5,k1)=(k4,k5,k1, k2,k3)
P10=(k3,k5,k2,k7,k4,k10,k1,k9,k8,k6)
1000001100
P8=(k6,k3,k7,k4,k8,k5,k10,k9) 01100
10000
00001 11000
000011100
10100100
K1
00100 00011
00100
01000011
K2
• p8=[6 3 7 4 8 5 10 9]
• key=[1 0 1 0 0 0 0 0 1 0]
• p10_conv=key(p10)
• L=p10_conv(1:5)
• R=p10_conv(6:10)
• LS_shift1=circshift(L,[1-1])
• RS_shift1=circshift(R,[1 -1])
• LRresult1=[LS_shift1,RS_shift1]
• P8_conv1=LRresult1(p8)
• k1=P8_conv1
• The Function fk
– Let L and R be left and right halves of 8-bit input to fk .
– Let F be a map from 4-bit strings to 4-bit strings, and
SK be the subkey (K1 or K2) and XOR is the bit-by-
bit exclusive-OR function.
fk(L, R) = (L F(R, SK), R)
E/P
n4 n1 n2 n3
4 1 2 3 2 3 4 1 n2 n3 n4 n1
1101
10100100
+ K1
0111
1 0 3 2 0110
S0
3 2 1 0
IP 2 3
0 2 1 3
2 6 3 1 4 8 5 7 10 11
3 1 3 2
0111
E/P S1 0 1 2 3
4 1 2 3 2 3 4 1 2 0 1 3
3 0 1 0 +
2 1 0 3 1101 1001
P4 = (k2k4k3k1)
1110
01000011
+ K2
1000
1 0 3 2 1010
S0
3 2 1 0
IP-1 2 3
0 2 1 3
4 1 3 5 7 2 8 6 10 11
3 1 3 2
0111
E/P S1 0 1 2 3
4 1 2 3 2 3 4 1 2 0 1 3
3 0 1 0 +
2 1 0 3 1110 1101
P4 = (k2k4k3k1)
01110111
• EP=[4 1 2 3 2 3 4 1]
• p4=[2 4 3 1]
• PT=[0 1 1 1 0 0 1 0]
• XOR1=xor(EP_conv,k1)
• L1=bin2dec('00') 0
• L2=bin2dec('11')3
• sbox0=s0(L1+1,L2+1)
• sbox0_conv=dec2bin(sbox0)
• R1=bin2dec('01')
• R2=bin2dec('11')
• sbox1=s1(R1+1,R2+1)
• sbox1_conv=dec2bin(sbox1)
1001
01000011
+ K2
1000
1 0 3 2 1010
S0
3 2 1 0
IP 2 3
0 2 1 3
2 6 3 1 4 8 5 7 10 11
3 1 3 2
0111
E/P S1 0 1 2 3
4 1 2 3 2 3 4 1 2 0 1 3
3 0 1 0 +
2 1 0 3 1001 1101
P4 = (k2k4k3k1)
1010
10100100
+ K1
0111
1 0 3 2 0110
S0
3 2 1 0
IP-1 2 3
0 2 1 3
4 1 3 5 7 2 8 6 10 11
3 1 3 2
0111
E/P S1 0 1 2 3
4 1 2 3 2 3 4 1 2 0 1 3
3 0 1 0 +
2 1 0 3 1010 1001
P4 = (k2k4k3k1)
01110010
Parity drop(PC-1)
56 bits
28 bits 28 bits
28 bits 28 bits
Compression
P-Box
Round Key 2
28 bits 28 bits
Compression
P-Box
Round Key 16
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Example
• key=0 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 0 1 1 1 0 0 0 1 1 1 0 0 1 0 0 1 0 1 0 0 0 1 1 1 1 1 0 1
10011110100001011001
• L=1101000111111000100010010100
• 1 2 3 4 5 6 7 8 9 10 28
• Ls-L=1 1 0 1 0 0 0 1 1 1 1 1 1 0 0 0 1 0 0 0 1 0 0 1 0 1 0 0
• Ls-R=0010001000100111110100101100
48-bit input
6-bits 6-bits 6-bits 6-bits 6-bits 6-bits 6-bits 6-bits
Kn (+)
S Box1 S Box2 S Box3 S Box4 S Box5 S Box6 S Box7 S Box8
32-bit permutation
32-bit output
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
S-Box (contd.)
14 4 13 1 2 15 11 8 3 10 6 12 5 9 0 7
0 15 7 4 14 2 13 1 10 6 12 11 9 5 3 8
S1
4 1 14 8 13 6 2 11 15 12 9 7 3 10 5 0
15 12 8 2 4 9 1 7 5 11 3 14 10 0 6 13
15 1 8 14 6 11 3 4 9 7 2 13 12 0 5 10
3 13 4 7 15 2 8 14 12 0 1 10 6 9 11 5
S2
0 14 7 11 10 4 13 1 5 8 12 6 9 3 2 15
13 8 10 1 3 15 4 2 11 6 7 12 0 5 14 9
10 0 9 14 6 3 15 5 1 13 12 7 11 4 2 8
13 7 0 9 3 4 6 10 2 8 5 14 12 11 15 1
S3
13 6 4 9 8 15 3 0 11 1 2 12 5 10 14 7
1 10 13 0 6 9 8 7 4 15 14 3 11 5 2 12
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
S-Box (contd.)
7 13 14 3 0 6 9 10 1 2 8 5 11 12 4 15
13 8 11 5 6 15 0 3 4 7 2 12 1 10 14 9
S4
10 6 9 0 12 11 7 13 15 1 3 14 5 2 8 4
3 15 0 6 10 1 13 8 9 4 5 11 12 7 2 14
2 12 4 1 7 10 11 6 8 5 3 15 13 0 14 9
14 11 2 12 4 7 13 1 5 0 15 10 3 9 8 6
S5
4 2 1 11 10 13 7 8 15 9 12 5 6 3 0 14
11 8 12 7 1 14 2 13 6 15 0 9 10 4 5 3
12 1 10 15 9 2 6 8 0 13 3 4 14 7 5 11
10 15 4 2 7 12 9 5 6 1 13 14 0 11 3 8
S6
9 14 15 5 2 8 12 3 7 0 4 10 1 13 11 6
4 3 2 12 9 5 15 10 11 14 1 7 6 0 8 13
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
S-Box (contd.)
4 11 2 14 15 0 8 13 3 12 9 7 5 10 6 1
13 0 11 7 4 9 1 10 14 3 5 12 2 15 8 6
S7
1 4 11 13 12 3 7 14 10 15 6 8 0 5 9 2
6 11 13 8 1 4 10 7 9 5 0 15 14 2 3 12
13 2 8 4 6 15 11 1 10 9 3 14 5 0 12 7
1 15 13 8 10 3 7 4 12 5 6 11 0 14 9 2
S8
7 11 4 1 9 12 14 2 0 6 10 13 15 3 5 8
2 1 14 7 4 10 8 13 15 12 9 0 3 5 6 11
Note: DES subkeys are shown as eight 6-bit values in hex format
Copyright © 2020 Pearson Education, Inc. All Rights Reserved.
Table 4.3 Avalanche Effect in DES: Change in Plaintext
Time Required
Key Size Number of Time Required at 10 9
at 1013
(bits) Cipher Alternative Keys Decryptions/s Decryptions/s
56 DES 256 ≈ 7.2 × 1016 255 ns = 1.125 years 1 hour
128 AES 2128 ≈ 3.4 × 1038 2127 ns = 5.3 × 1021 years 5.3 × 1017 years
168 Triple DES 2168 ≈ 3.7 × 1050 2167 ns = 5.8 × 1033 years 5.8 × 1029 years
192 AES 2192 ≈ 6.3 × 1057 2191 ns = 9.8 × 1040 years 9.8 × 1036 years
256 AES 2256 ≈ 1.2 × 1077 2255 ns = 1.8 × 1060 years 1.8 × 1056 years
• Apply IP
58 50 42 34 26 18 10 2 0 1 0 1 1 0 1 0
60 52 44 36 28 20 12 4 0 0 0 0 0 0 0 0
Left
62 54 46 38 30 22 14 6 0 1 0 1 1 0 1 0
bits
64 56 48 40 32 24 16 8 0 0 0 0 0 0 0 0
57 49 41 33 25 17 9 1 0 0 1 1 1 1 0 0
1 1 1 1 0 0 0 0
59 51 43 35 27 19 11 3
Right 0 0 1 1 1 1 0 0
61 53 45 37 29 21 13 5 bits
0 0 0 0 1 1 1 1
63 55 47 39 31 23 15 7
1 0 0 1 1 1 32 1 2 3 4 5
1 1 1 0 0 1 4 5 6 7 8 9
0 1 1 1 1 0 8 9 10 11 12 13
1 0 0 0 0 0 12 13 14 15 16 17
0 0 0 1 1 1 16 17 18 19 20 21
1 1 1 0 0 0 20 21 22 23 24 25
0 0 0 0 0 1 24 25 26 27 28 29
0 1 1 1 1 0 28 29 30 31 32 1
Apply S-Box
S1=111001, Row=3,Colomn=12 1010 0011 0010
S2=110010, Row=2,Colomn=9 0011
S3=010001, Row=1,Colomn=8 0010
S4=100011, Row=3,Colomn=1 1111
S5=001111, Row=1,Colomn=7 0001
S6=110101, Row=3,Colomn=10 0001
S7=101000, Row=2,Colomn=4 1100
S8=101110, Row=2,Colomn=7 0010
1 1 1 0 0 0 0 0 16 7 20 21 29 12 28 17
1 1 0 1 0 0 1 0 1 15 23 26 5 18 31 10
0 1 1 1 0 0 1 0 2 8 24 14 32 27 3 9
0 1 0 0 0 1 0 1 19 13 30 6 22 11 4 25
• 10111010110100100010100001000101
• 1001100111101001101101110010001100001011101011100011101110011110
• The more nonlinear F, the more difficult any type of cryptanalysis will be
• The SAC and BIC criteria appear to strengthen the effectiveness of the
confusion function