BCSE309L - MODULE2 - Symmetric Cipher
BCSE309L - MODULE2 - Symmetric Cipher
Security
M ODULE - 2
2
Some Basic Terminology
• Plaintext - Original message
• Ciphertext - Coded message
• Cipher - Algorithm for transforming plaintext to ciphertext
• Key - Info used in cipher known only to sender/receiver
• Encipher (encrypt) - Converting plaintext to ciphertext
• Decipher (decrypt) - Recovering plaintext from ciphertext
• Cryptography - Study of encryption principles/methods
• Cryptanalysis (codebreaking) - Study of principles / methods of
deciphering ciphertext without knowing key
• Cryptology - Field of both cryptography and cryptanalysis
3
Symmetric Encryption
4
Symmetric Encryption
• It is a form of cryptosystem in which encryption and
decryption are performed using the same key
• Also known as conventional / private-key / single-key
encryption
• Sender and recipient share a common key
• All classical encryption algorithms use private-key
• Was only type prior to invention of public-key in 1970’s
5
Symmetric Encryption
6
Simplified Model of Symmetric Encryption
K K
X=D[K,Y]
Y=E(K,X
)
7
Requirements
8
Model of Symmetric Cryptosystem
9
Cryptography
10
Substitution Techniques
Substitution Techniques
Substitution Techniques
Caesar Cipher
Vigenere Cipher
14
Substitution Techniques
Vigenere Cipher
Substitution Techniques
Substitution Techniques
Playfair Cipher
18
Substitution Techniques
Relative Frequency of Letters in English Text
As a first step, the relative frequency of the letters can be determined and
compared to a standard frequency distribution for English as shown in Figure
Substitution Techniques
Substitution Techniques
Playfair Cipher
• GREET
• MANGO
25
Substitution Techniques
26
Substitution Techniques
Playfair Cipher
Substitution Techniques
Playfair Cipher
Substitution Techniques
Playfair Cipher
Substitution Techniques
Playfair Cipher
Key : MONARCHY
Plaintext : INSTRUMENTSZ
Ciphertext : ?
Substitution Techniques
Playfair Cipher
Substitution Techniques
Playfair Cipher
Decryption
• Decrypting the Playfair cipher is as simple as doing the
same process in reverse.
• The receiver has the same key and can create the same
key table, and then decrypt any messages made using
that key.
Key : MONARCHY
Ciphertext : gatlmzclrqtx
Plaintext : ?
32
Substitution Techniques
Playfair Cipher
34
Substitution Techniques
Playfair Cipher
Decryption
CipherText: "gatlmzclrqtx"
After Split: 'ga' 'tl' 'mz' 'cl' 'rq' 'tx'
35
Hill Cipher
36
Hill Cipher
• Hill cipher was developed by the
mathematician Lester Hill in 1929.
• The encryption algorithm takes m successive
plaintext letters and substitutes for them m
ciphertext letters.
Hill Cipher
• Step 1 – Select a Message to Encrypt
sathish
• Step 2 – Select a Key
– If we encrypt 2 letters at a time then key size is 2 x 2
matrix
– If we encrypt 3 letters at a time then the key should be 3
x 3 matrix
Ex: sa th is h
sa th is ha
d b
g f =
Key K is Done
Hill Cipher
STEP 5
• Ciphertext (C) = P * K mod 26
• Plaintext (P) = K-1 C mod 26
= K-1 * K * P mod 26
= K-1 * K * P mod 26
Hill Cipher Encryption
Ciphertext (C) = P * K mod 26
Plaintext (P) = C K-1 mod 26
= K * P * K-1 mod 26
= K-1 * K * P mod 26
43
Hill Cipher Encryption
Ciphertext (C) = K * P mod 26
Key
Plaintext
Hill Cipher Encryption
Ciphertext (C) = K * P mod 26
Key
Plaintext
Hill Cipher Encryption
54= 2 x 26 + 2
108= 4 x 26 + 4
Hill Cipher Encryption
* mod 26
Hill Cipher Encryption
Hill Cipher Encryption
* mod 26
Hill Cipher Encryption
Hill Cipher Encryption
*
mod 26
Hill Cipher Encryption
Hill Cipher Encryption
• Plaintext = sathisha
• Ciphertext = cemtqivq
54
Hill Cipher Decryption
Hill Cipher Decryption
Ciphertext = K * P mod 26
K -1 = 1 / |K| * adj(K)
Determinant
+ - + -
a1 b1 c1 d1 b2 c2 d2
• 4*4 matrix a2 b2 c2 d2 a1 * b3 c3 d3
a3 b3 c3 d3 b4 c4 d4
a1 b1 c1 d1 a4 b4 c4 d4 a1 * (b2 (c3d4-d3c4))
a2 b2 c2 d2
X=
a3 b3 c3 d3 .
a4 b4 c4 d4 .
.
|X| = a1(b2 (c3d4-d3c4))-b1(a2(c3d4-d3c4))+c1(a2(b3d4-d3b4))-d1(a2(b3c4-c3b4))
58
Compute 1 / |K|
K= Find | K |
K=
K-1 = (1 / |K|) * adj(K)
We have 1 / |K| = 3
and adj(k)
*3 =
K-1 = mod 26
Plain Text = K-1 C mod 26
Plain Text = K-1 C mod 26 Decryption
Ciphertext = cemtqivq
= ce mt qi vq
K -1 =
2 12 16 21
4 19 8 16 Cipher text
C
c m q v
e t i q
Hill Cipher Decryption
2
* mod 26
4
Hill Cipher Decryption
Hill Cipher Decryption
12
* mod 26
19
Hill Cipher Decryption
Hill Cipher Decryption
16
mod 26
*
8
Hill Cipher Decryption
Hill Cipher Decryption
21
* mod 26
16
Hill Cipher Decryption