Cipher Ch3. Block Ciphers and the Data Encryption Standard Department of Computer Science Academic Year: 2017-2018 Semester: One Dr. Maytham Mustafa Hammood Cipher
Cipher
Ch3. Block Ciphers and the Data Encryption Standard
Department of Computer ScienceAcademic Year: 2017-2018
Semester: One
Dr. Maytham Mustafa Hammood
Cipher
Modern Block Ciphers
now look at modern block ciphers
one of the most widely used types of cryptographic algorithms
provide secrecy /authentication services
focus on DES (Data Encryption Standard)
to illustrate block cipher design principles
Cipher
Block vs Stream Ciphers
• block ciphers process messages in blocks, each of which is then en/decrypted
• like a substitution on very big characters
– 64-bits or more
• stream ciphers process messages a bit or byte at a time when en/decrypting
Cipher
Block vs Stream Ciphers
Cipher
Claude Shannon and Substitution-Permutation Ciphers
Claude Shannon introduced idea of substitution-permutation (S-P) networks in 1949 paper
form basis of modern block ciphers
S-P nets are based on the two primitive cryptographic operations seen before:
substitution (S-box)
permutation (P-box)
provide confusion & diffusion of message & keyClaude Elwood Shannon (April 30, 1916 – February 24, 2001)
Cipher
Confusion and Diffusion
• cipher needs to completely obscure statistical properties of original message
• a one-time pad does this
• more practically Shannon suggested combining S & P elements to obtain:
• diffusion – dissipates statistical structure of plaintext over bulk of ciphertext
• confusion – makes relationship between ciphertext and key as complex as possible
Cipher6
Feistel Cipher Structure
Cipher 7
Feistel Cipher Design Elements
block size key size number of rounds subkey generation algorithmround function fast software en/decryptionease of analysis
Cipher
History of DES Algorithm
In 1977, the results of Tuchman’s project of
IBM was adopted as the Data Encryption
Standard by NSA (NIST).
Cipher
DES – Initial Permutation Function
• Before first rounds, the plaintext bits are
permuted using an initial permutation. IP
IP Table
Cipher
IP (Initial Permutation):
8 16 24 32 40 48 56
8 16 24 32 40 48 56
IP
5842 50
Cipher
12
32 bits
32 bits32 bits 28 bits28 bits
Cipher
Expansion
32 1 2 3 4 5
4 5 6 7 8 9
8 9 10 11 12 13
12 13 14 15 16 17
16 17 18 19 20 21
20 21 22 23 24 25
24 25 26 27 28 29
28 29 30 31 32 1
E
ExpansionExpansion
13
Cipher
1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32
1 48
Expansion Permutation
32
48
Cipher
1 48
X-OR with 48 bit key
1 48
48
48
48
Cipher
S-box
1
S-box
2
S-box
3
S-box
4
S-box
5
S-box
6
S-box
7
S-box
8
1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32
1 48
S-Box Substitution
48
32
Cipher
Cipher
Cipher
DES: S-Boxes (1-4)
Cipher
DES: S-Boxes (5-8)
Cipher
Permutation
16 7 20 21 29 12 28 17
1 15 23 26 5 18 31 10
2 8 24 14 32 27 3 9
9 13 30 6 22 11 4 25
P – Box Table
Cipher
1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32
P-Box Permutation
32
32
1 4 5 8 9 12 13 16 17 20 21 24 25 28 29 32
Cipher
Inverse Permutation
• Hence, at the end of the 16 rounds the inverse permutation is
applied.
IP-1 Table
Cipher
IP-1 (Final Permutation):
8 16 24 32 40 48 56
8 16 24 32 40 48 56
Cipher
Cipher
• PC-157 49 41 33 25 17 9
1 58 50 42 34 26 18
10 2 59 51 43 35 27
19 11 3 60 52 44 36
63 55 47 39 31 23 15
7 62 54 46 38 30 22
14 6 61 53 45 37 29
21 13 5 28 20 12 4
Cipher
• PC-2
14 17 11 24 1 5
3 28 15 6 21 10
23 19 12 4 26 8
16 7 27 20 13 2
41 52 31 37 47 55
30 40 51 45 33 48
44 49 39 56 34 53
46 42 50 36 29 32
Cipher
• Iteration corresponds to left shifts:
1 2 3 4 5 6 7 8
1 1 2 2 2 2 2 2
9 10 11 12 13 14 15 16
1 2 2 2 2 2 2 1
Cipher
Initial Key Permutation
8 16 24 32 40 48 56
8 16 24 32 40 48 56
64
Cipher
Key Split & Shift & Compress8 16 24 32 40 48 56
Shift left by Ni Shift left by Ni
8 16 24 32 40 48 56
Ni = {1,1,2,2,2,2,2,2,1,2,2,2,2,2,2,1}
8 16 24 32 40 48
Shift accumulates every round
K48
K56
Permuted choice 2 TableCipher
DES Example - Key• K=581FBC94D3A452EA• P=3570E2F1BA4682C7
0101 1000 0001 1111 1011 1100 1001 0100
1101 0011 1010 0100 0101 0010 1110 1010• PC-1
C= 57 49 41 33 25 17 9 1 58 50 42 34 26 18
10 2 59 51 43 35 27 19 11 3 60 52 44 36
D = 63 55 47 39 31 23 15 7 62 54 46 38 30 22
14 6 61 53 45 37 29 21 13 5 28 20 12 4
K=
Cipher
DES Example - Key
Cipher
DES Example - Data• K=581FBC94D3A452EA
• P=3570E2F1BA4682C7
0011 0101 0111 0000 1110 0010 1111 0001
1011 1010 0100 0110 1000 0010 1100 0111P=
Cipher
DES Example - DataE(R(i-1)) K(i)
S100(1001)=s1
0(9)=10= 1010
Cipher
DES Example - Data
16 7 20 21 29 12 28 17
1 15 23 26 5 18 31 10
2 8 24 14 32 27 3 9
9 13 30 6 22 11 4 25
Cipher
R(i) = L(i-1) P(S( E(R(i-1)) K(i) ))
DES Example - Data
Cipher
DES Example - Data
L(i) = R(i-1)
Cipher
DES Example - Data
Cipher
DES Example - Data
Cipher
DES Example - Data - Done !
Cipher