Classical Cryptography
Classical Cryptography
Substitution Cipher
Transposition Cipher
Vigenère Cipher
Hill Cipher
Playfair Cipher
Z E B R A C D F G H I J K L MN O P Q S T U VWX Y
A B C D E F G H I J K L MN O P Q R S T U VWX Y Z
Intercepted message:
VHVSSPQUCEMRVBVBBBVHVSURQGIBDUGRNICJQU
CERVUAXSSR
The gap between the "VHVS" pair is 18, implies key length
may be 18, 9, 6, 3 or 2. The gap between the "QUCE" pair is
30, implies key length 30, 15, 10, 6, 5, 3 or 2.
So, looking at both together the most likely key length is 6 or
possibly 3 (though in practice this is unlikely).
A B C D E F G H I J K L M
11 6 11 3 5 5 6 13 8 4 7 5 12
N O P Q R S T U V W X Y Z
7 2 8 14 6 7 9 8 18 10 8 9 3
26
1
𝐼𝐶 = 𝑓𝑖 𝑓𝑖 − 1 = 0.041989
𝑁(𝑁 − 1)
𝑖=1
C H R E E V O A H M A E R AT B I A X X W T N X B E E O P H B S
B Q M Q E Q E R B W RV X U O A K X A O S X X W E A H B W G
A B C E G H I K M N
7 6 1 8 1 4 1 1 2 1
O P Q R S T U V W X
4 1 3 4 2 2 1 2 4 7
Suppose x = x1, x2 ., xn , and y = y1, y2 ., yn are strings of n and n
alphabetic characters, respectively. The mutual index of coincidence
of x and y, denoted MIC(x, y), is the probability that a random
element of x is identical to a random element of y.
σ25 𝑓 𝑓
𝑖=0 𝑖 𝑖
′
𝑀𝐼𝐶 x, y =
𝑛𝑛′
Where fi and fi are the frequency count of ith letter in x and y
respectively.
Index of alphabet 0 + ki 1 + ki 25 + ki
Probability p0 p1 p25
The value of this estimate depends only on the difference ki – kj (mod 26), which is
called the relative shift of zi and zj.
25 25
𝑝ℎ 𝑝ℎ+𝑙 = 𝑝ℎ 𝑝ℎ−𝑙
ℎ=0 ℎ=0
i.e., relative shift of l yields the same estimate of MIC as does a relative shift of 26 – l.
P = [A T]T = [0 19]T
3 2 0 12 𝑀
𝐶= mod 26 = = , AT → MR
3 5 19 17 𝑅
15 20 3 2 15 20 1 0
Decryption: 𝐾 −1 = ,∵ mod 26 =
17 9 3 5 17 9 0 1
15 20 12 0 𝐴
𝑃= mod 26 = = , MR →AT
17 9 17 19 𝑇
𝑛2
Key space: 26
known-plaintext attack
Suppose it is 2 by 2 hill cipher
In standard English, the most frequent digraph is ‘TH', followed by ‘HE'.
Suppose in the cipher text the most frequent digraph is ‘KX', followed
by ‘VZ'
Guess: TH → KX and HE → VZ
or [19, 7] → [10, 23] and [7, 4] → [21, 25]
Find 𝑃−1 = 4 19
mod 2 6
19 19
Since K = C × P -1
10 21 4 19 23 17
∴𝐾= × mod 26 =
23 25 19 19 21 2