Week 5-Block Cipher & DES
Week 5-Block Cipher & DES
=====================
Stream Cipher:
============
Is one that encrypts a digital data stream one bit or one byte at a time.
Block Cipher:
===========
is one which a block of plaintext of sizes ( 64 to 128 bits) is treated as whole & used to
produce cipher text of equal length
10 (00, 01)
11 (00)
2^n!
Irreversible Mapping
=================
Plaintext Ciphertext
Questions:
=========
● A cipher block operates on a plaintext block of size n bits. How many different irreversible
mappings can result?
Answer:
=======
2n different mapping
Diffusion:
========
● Is where the statistical structure of the plaintext is dissipated into long range statistics of
the ciphertext
● To prevent cryptanalysis by letter frequencies.
Confusion:
=========
● Is where the relationship between the statistics of the ciphertext & the value of the key is
as complex as possible
● Difficult to deduce key given ciphertext
Substitution:
==========
● Is performed on the left side of the data by applying the round function F to the right half &
XORing with the left
Permutation:
===========
● Occurs when the two halves of data are interchanged
Parameters & design features of the Feistel cipher:
===================================
1. Block Size:
○ Larger block size--> larger security but reduced encryption / decryption speed
(64.. 128 bits)
2. Key Size:
○ Larger key size--> larger security but reduced encryption / decryption speed (64..
128 bits)
1. Number of rounds:
○ Single round is not secure but multiple rounds offer increased security (16
rounds)
1. Round Function
○ Greater complexity--> greater difficulty of cryptanalysis
1. Other:
○ Fast software encryption / decryption
○ Ease of analysis
123=>loijhggvbkbvfdsrety
Avalanche Effect:
==============
A small change in the plaintext or key causes a large change in the
ciphertext
Note:
====
● DES is now prone to BFA with its key size & high processing power
● DES may also be susceptible to cryptanalysis attack due to its s-boxes
Algorithm of DES:
===============
● Part 1: Key Generation:
=================
1. Convert it to binary (64 bits)
2. Apply Permutation choice 1 (56 bits)
3. Divide Key left and right
4. Apply left shift table for the 16 keys
5. Concatenate left & right
6. Apply Permutation Choice 2 ( 48 bits)
● Part 2: Message Encryption:
======================
1. Apply Initial Permutation (64 bits )
2. Divide Message into left & right (32, 32).
3. Find left 1 , right 1
1. Left 1=Right 0
2. Right 1= ( Left 0 + Function ( Right 0, Key 1) )
1. Function (Right 0, key 1)
===================
Right 0==> 32 bits
Key 1===> 48 bits
So, we will apply expansion to the right part
1. Left 0 + Function
==============
Left 0===> 32 bits
Function-> 48 bits
So we will apply s-box for the function results
1. Concatenate right, left
2. Apply inverse Permutation
Permutation Choice 1:
3 5 2 7 4 10 1 9 8 6
Shift table:
Round 1 1 bit
Permutation Choice 2:
6 3 7 4 8 5 10 9
IP:
2 6 3 1 4 8 5 7
Expansion :
4 1 2 3 2 3 4 1
S-box 1:
1 0 3 2
3 2 1 0
0 2 1 3
3 1 3 2
S-box 2:
0 1 2 3
2 0 1 3
3 0 1 0
2 1 0 3
Solution:
=======
● Part 1: Key Generation:
===================
1. Apply Permutation choice 1 (56 bits)
key be 1100011110.
1 2 3 4 5 6 7 8 9 10
1 1 0 0 0 1 1 1 1 0
3 5 2 7 4 10 1 9 8 6
0 0 1 1 0 0 1 1 1 1
Key : 0011001111
Left 0: 00110
Right 0: 01111
1. Apply left shift table for the 16 keys
1 2 3 4 5 6 7 8 9 10
0 1 1 0 0 1 1 1 1 0
6 3 7 4 8 5 10 9
1 1 1 0 1 0 0 1
Key: 11101001
● Part 2: Message Encryption:
======================
1 2 3 4 5 6 7 8
1 0 1 0 1 0 0 0
IP:
2 6 3 1 4 8 5 7
0 0 1 1 0 0 1 0
Message : 00110010
Left 0: 0011
Right 0: 0010
0 0 1 0
4 1 2 3 2 3 4 1
0 0 0 1 0 1 0 0
1. Left 0 + Function
==============
Left 0===> 0011
Function-> 11111101
So we will apply s-box for the function results
3 2 1 0
0 2 1 3
3 1 3 2
2 0 1 3
3 0 1 0
2 1 0 3
IP:
1 2 3 4 5 6 7 8
2 6 3 1 4 8 5 7
IP-1:
1 2 3 4 5 6 7 8
4 1 3 5 7 2 8 6
1 1 1 0 1 0 1 0
1 2 3 4 5 6 7 8
1 0 1 1 0 0 1 1
110111
Row number : 11: 3
Column number :1011 :11
Value =3: 0011
Other examples:
● Plaintext: 11010101; Key: 0111010001
● Plaintext: 01001100; Key: 1111111111
● Plaintext: 00000000; Key: 0000000000
● Plaintext: 11111111; Key: 1111111111