4 Block Ciphers
4 Block Ciphers
Security
Block Cipher
By
Dr. Mudassar Raza
Professor
Department of Computer Science
Namal University Mianwali https://techgirls.ece.vt.edu/slides/introduction_to_cybersecurity.html#39
• Stream cipher is one that encrypts a digital data stream one bit (or
byte) at a time
• Example: autokey Vigenère system
• Block cipher is one in which the plaintext is divided in blocks and one
block is encrypted at one time producing a ciphertext of equal length
• Similar to substitution ciphers on very big characters: 64 bits or 128 bits are
typical block lengths
• Many modern ciphers are block ciphers
• Diffusion
• Makes the statistical relationship plaintext -ciphertext as complex as possible
• Achieved by requiring that every digit of the plaintext affects many digits of
the ciphertext (equivalently, every digit of the ciphertext is affected by many
digits of the plaintext
K1 = P8(Shift(P10(key)))
K2 = P8(Shift(Shift(P10(key))))
1 2 3 4 5 6 7 8 9 10
10 bit Key: 0 0 1 0 0 1 0 1 1 1
permutation P10: 3 5 2 7 4 10 1 9 8 6
permutation P8: 6 3 7 4 8 5 10 9
1 2 3 4 5 6 7 8 9 10
After Apply LS-1 (left shift 1)
to each 5-bit group
0 0 0 0 1 0 1 1 1 1
permutation P8: 6 3 7 4 8 5 10 9
KEY2
1 2 3 4 5 6 7 8
Input: 1 0 1 0 0 1 0 1
Initial permutation IP 2 6 3 1 4 8 5 7
expansion/permutation
E/P to input 4 bits
4 1 2 3 2 3 4 1
Apply E/P: 0 0 1 0 1 0 0 0
Key1: 0 0 1 0 1 1 1 1
(C) Pass left 4 bits through S0 and right four bits through S1:
0 1 2 3 0 1 2 3
0 1 0 3 2 0 0 1 2 3 The fisrt and last bit ow a row
1 3 2 1 0 1 2 0 1 3 specify the column and the
second and third bit the row of
2 0 2 1 3 2 3 0 1 0
the S-box. The entry at the
3 3 1 0 3 3 2 1 0 3 specified location is the 2-bit
output.
0 1 1 1
By: Dr. Mudassar Raza
ENCRYPTION
0 1 1 1 IP
0 1 1 1 0 1 0 0
permutation P4: 2 4 3 1
xor 0 1 1 1
1 0 0 1
1 0 0 1 0 1 0 0
Apply SW:
0 1 0 0 1 0 0 1
(C) Pass left 4 bits through S0 and right four bits through S1:
0 0 1 0
0 1 1 0 1 0 0 1
Apply IP-1: 0 0 1 1 0 1 1 0