Week 5 DES
Week 5 DES
SENS-4533
Week 6
Block ciphers, DES
Dr Nauman Mazhar
Faculty of Information Technology
University of Central Punjab (UCP)
Outline
Block cipher principles
◦ Feistel cipher structure
Data Encryption Standard (DES)
DES encryption & decryption
Key schedule
Strength of DES
DES variants
◦ Double DES, Tripple DES
2
Block Ciphers
Block ciphers
◦ Encrypt block of plaintext at a time
plaintext block of b bits encrypted
as a whole
produces ciphertext block
of equal length
3
Block Cipher Principles
Most symmetric block ciphers are based on Feistel Cipher
◦ Feistel proposed use of Product Cipher
◦ cipher alternates between substitution/permutation
Permutation
5
Feistel Cipher
Decryption:
Same algo as encryption
◦ use ciphertext as input to algo
Advantage...
◦ no need to implement two separate algos for encryption
& decryption
6
Data Encryption Standard
(DES)
7
Data Encryption Standard
DES
Most widely used symmetric encryption scheme
◦ algo referred to as Data Encryption Algo (DEA)
Block cipher
◦ block size 64 bits → encrypt 64 bit data blocks
◦ key length 64 bits → effective key size 56 bits
8
DES History
IBM developed Lucifer cipher in 1971
◦ team led by Feistel → Feistel cipher structure
64 bit data block, 128 bit key
9
DES
Encryption
10
Initial Permutation (IP)
IP reorders input data bits
1 2 3 4 5 6 7 8
9 10 11 12 13 14 15 16
11
Inverse Initial Permutation (IP-1)
1 2 3 4 5 6 7 8
12
DES Round Structure
DES uses two 32-bit halves; L & R
◦ As for any Feistel cipher :
Li = Ri–1
Ri = Li–1 XOR F(Ri–1, Ki)
13
Single Round of DES Algorithm
©Copyright 2004. Amir Qayyum. All
rights reserved 14
DES: The Function ‘F’
15
Expansion Permutation
32 bit R half expanded to same length as 48 bit subkey
consider R as 8 nibbles (4 bits each)
copy each nibble into middle of 6 bit block
copy end bits of two adjacent nibbles, into two end bits
of 6 bit block
16 of the R bits
are duplicated
Resulting 48 bits
XORed with Ki
16
Substitution Boxes S
Eight S-boxes - map 6 bits to 4 bits
◦ outer bits 1 & 6 select one row
(row bits)
◦ inner bits 2 to 5 select column input symbol
(col bits)
control
Si
◦ intersection value substituted
output symbol
◦ implements contraction substitution
S-Box (4 x 16)
17
Substitution Boxes S
18
Permutation Box ‘P’
1 2 3 4 5 6 7 8
P-box at the end of each round 9 10 11 12 13 14 15 16
8 S-boxes 25 26 27 28 29 30 31 32
19
DES Key Schedule
Generate subkeys used in each round...
Initial permutation (PC1)
◦ select & permute 56 bits into two 28 bit halves
20
DES Key
Schedule
21
DES Key Schedule
Initial 64 bit key
56 bits selected
22
DES Key Schedule
1 2 3 4 5 6 7 8
23
DES Key Schedule
• Each 28 bit half undergoes left circular shift of 1 or 2 bits
24
DES Decryption
DES decryption uses same algo as for encryption
25
DES Example Encryption
26
Avalanche Effect
A key desirable property of encryption algorithms…
A small change in either plaintext or key
should produce a significant change in ciphertext
In particular...
a change in one bit of plaintext, or one bit of key,
should produce a change in many bits of ciphertext
27
Avalanche Effect
DES shows strong
avalanche
Table shows
DES avalanche effect
with change of
one plaintext bit
Change in one
input bit,
changes approx half
output bits
28
Strength of DES
Concerns about strength of DES :
◦ Brute force attack
◦ Cryptanalytic attack
29
Strength of DES
Differential Cryptanalysis
◦ discovered in late 1980s → Eli Biham & Adi Shamir
◦ needs 247 chosen plaintexts to break full 16 rounds
◦ possible to recover DES key
Linear Cryptanalysis
◦ discovered in 1994 → Mitsuru Matsui
◦ needs 243 known plaintexts
◦ tries to find linear approximations to encryption process
◦ uses statistical methods to recover the key
30
Multiple Encryptions & DES
Alternatives...
• AES – has come out as a new cipher
• Prior to this, multiple encryptions with DES
o Double DES
o Triple DES with 2 keys
o Triple DES with 3 keys
• Triple DES is the chosen form
31
Double DES
Could use 2 DES encrypts on each block
C = EK2 (EK1 (P) )
“Meet-in-the-middle” attack :
X = EK1(P) = DK2(C)
encrypt P with all possible keys, & store X values
decrypt C with all possible keys, & match previous X values
32
Tripple DES with Two Keys
Hence, must use 3 encryptions…
Can use 2 keys with E-D-E sequence
C = EK1 (DK2 (EK1 (P) ) )
encrypt & decrypt equivalent in security
if K1 = K2 then can work with single DES
33
Tripple DES with Three Keys
34
Tripple DES
Encryption
Decryption
35
Ex : Simplified DES
Simplified DES encryption algo shown
in diagram
K1 = 1101 0101
K2 = 1000 1101
36
Ex : Simplified DES
IP IP-1
2 6 3 1 4 8 5 7 4 1 3 5 7 2 8 6
E/P P4
4 1 2 3 2 3 4 1 2 4 3 1
So 0 1 2 3 S1 0 1 2 3
0 1 0 3 2 0 0 1 2 3
1 3 2 1 0 1 2 0 1 3
2 0 1 2 3 2 3 0 1 0
3 3 1 3 2 3 2 1 0 3
37
Summary
Block cipher design principles
DES
◦ Algo details
◦ Strength / weakness
◦ DES alternatives
38