CNS Module 02
CNS Module 02
Network Security
(BTIT13502)
Module 02 : Classical Encryption Techniques
Symmetric Cipher Model (Conventional Encryption)
Secret key shared by Secret key shared by
sender and recipient sender and recipient
K K
Transmitted
cipher text
Y = E(K, X)
X X
Plaintext Encryption Algorithm Decryption Algorithm Plaintext
input (e.g. AES) (reverse of encryption output
algorithm)
C = E(3, P) = (P + 3) mod 26
For decryption algorithm is:
P = D(3, C) = (C - 3) mod 26
C = E(3, P) = (P + 3) mod 26
Plain: a b c d e f g h i j k l m n o p q r s t u v w x y z
Cipher: d e f g h i j k l m n o p q r s t u v w x y z a b c
Example:
Plaintext: THE QUICK BROWN FOX
Ciphertext: WKH TXLFN EURZQ IRA
Ciphertext:
uzqsovuohxmopvgpozpevsgzwszopfpesxudbmetsxaizvuephzhmdzshz
owsfpappdtsvpquzwymxuzuhsxepyepopdzszufpombzwpfupzhmdjudtm
ohmq
In our ciphertext, the most common digram is ZW, which appears
three times. So equate Z with t, W with h and P with e.
Now notice that the sequence ZWP appears in the ciphertext, and
we can translate that sequence as “the.”
Module 02 : Classical Encryption Techniques 19
Attack on Monoalphabetic Cipher (Cont…)
If the cryptanalyst knows the nature of the plaintext, then the
analyst can exploit the regularities of the language.
The relative frequency of the letters can be determined and
compared to a standard frequency distribution for English.
If the message were long enough, this technique alone might be
sufficient, but because this is a relatively short message, we
cannot expect an exact match.
O C U R E
Example: N A B D F
Keyword= OCCURRENCE
Plaintext= TALL TREES G H I/J K L
M P Q S T
V W X Y Z
Pair: UA AR BE DE XA PO PR QN XA XA NR
Plaintext: we wi lx lm ex et at th ex ex it
Plaintext: we wilxl mexet at thex exit
Plaintext: we will meet at the exit
H I 7 8
Key Matrix =
L L 11 11
E A 4 0
Plaintext =
X M 23 12
Module 02 : Classical Encryption Techniques 31
Hill Cipher Encryption (Cont…)
H I 7 8 E A 4 0
Key Matrix = = Plaintext =
L L 11 11 X M 23 12
C=PK mod 26
7 8 4 7 8 0
11 11 23 11 11 12
7 x 4 + 8 x 23 = 212 7 x 0 + 8 x 12 = 96
11 x 4 + 11 x 23 = 297 11 x 0 + 11 x 12 = 132
7 8 4 212 7 8 0 96
= =
11 11 23 297 11 11 12 132
212 4 E 96 18 S
= mod 26 = = mod 26 =
297 11 L 132 2 C
Ciphertext = “ELSC”
Module 02 : Classical Encryption Techniques 32
Hill Cipher Decryption
P=CK-1 mod 26
Step 1: Find Inverse of key matrix
Step 2: Multiply the Multiplicative Inverse of the Determinant by the
Adjoin Matrix
Step 3: Multiply inverse key matrix with ciphertext matrix to obtain
plaintext matrix
3 X 3 inverse of matrix
1
A−1 = ∙ adjoin(A)
determinant(A)
Determinant 1 3 5 7 9 11 15 17 19 21 23 25
Inverse Modulo 26 1 9 21 15 3 19 7 23 11 5 17 25
1 11 18
= mod 26
15 15 7
1
Multiplicative inverse of is 7
15
7 8 25 22
= thus, if K = then K −1 =
11 11 1 23
K
e
y
PT = HELLO
KEY = GMGMG
CT = NQRXU
Vigenere Cipher
Keyword : DECEPTIVE Key must be as
Key : DECEPTIVEDECEPTIVEDECEPTIVE long as plaintext
else repeat a
Plaintext : WEAREDISCOVEREDSAVEYOURSELF keyword
Ciphertext : ZICVTWQNGRZGVTWAVZHCQYGLMGJ
C = P1 + K1 , P2 + K 2 , … Pm + K m mod 26
P = C1 − K1 , C2 − K 2 , … Cm − K m mod 26
I R T N G
N E N T E H O O Y
T E C L
Unconditionally secure
• No matter how much time an opponent has, it is impossible for
him or her to decrypt the ciphertext simply because the
required information is not there
Computationally secure
• The cost of breaking the cipher exceeds the value of the
encrypted information
• The time required to break the cipher exceeds the useful
lifetime of the information