L-3 - Classical Ciphers 2
L-3 - Classical Ciphers 2
L-3 - Classical Ciphers 2
Classical
Cryptography
Classical
Cryptosystems
(Polyalphabetic)
Polyalphabetic Ciphers
• The simple substitution cipher is weak because the attacker can exploit
the fact that:
– The letter frequency distribution of the ciphertext will match the letter
frequency distribution of the plaintext
– These will generally follow the letter frequency distribution of the
plaintext language
• A simple way to defeat frequency analysis is to encipher each plaintext
letter with a different substitution alphabet
• The use of multiple substitution alphabets will mean that a plaintext letter
can encrypt to different ciphertext letters, thus causing the letter frequency
distribution to appear “flatter” (the individual letter frequencies are
averaged out)
19 7 8 18 2 17 24 15 19 14 18 24
K 2 8 15 7 4 17 2 8 15 7 4 17
21 15 23 25 6 8 0 23 8 21 22 15
C V P X Z G I A X I V W P
P s t e m i s n o t s e c u R e
18 19 4 12 8 18 13 14 19 18 4 2 20 17 4
K 2 8 15 7 4 17 2 8 15 7 4 17 2 8 15
20 1 19 19 12 9 15 22 8 25 8 19 22 25 19
C U B T T M J P W I Z I T W Z T
• So,
First step: determine the key length=m,
Second step: determine the key (word) itself
After that decryption of the message is easy.
Cryptanalysis of the
Vigenère Cipher
MRGFNIATXZQVFFNUXFFYBTCE25TYXIIXGZKACJLRGKQYEIX
OYYAUAPXYIJLHPRGVTSFPAYNNYURZOPHXWYXLFRNUTZBR
FKAHFWFZESYUWZMOLLBSBZBJHFPLXKHVIVMZTZHUIWAET
IUEDFGLXDIEXIYJIUXPNNEIXABVCINTVCIEZYYDAZGZIW
181
TYXJIKTRZLMFFKALGZNVKZXIIMXUUNAPGVXFUSMISKHVY
VOCRVXRIW235TYXZOIRFNUXZNXLDUDPZGVHVOWMOYJERLAUG
LVTUXTHRBUQZTYTXORNKBASFFXGHQVDSHUYJSYHDYUWYX
YYKHVTUCDACAHXSEVGJIEFZGLXRSBXSYKOEPPNYAKTUAC
EFYILFWEAHCIAUALLZNXMVCKLRRHGFNXMOYUESKPM
Index of Coincidence
• Now we will use the index of coincidence to see if it gives the same result.
• The index of coincidence is defined as follows:
25
Ic ( x ) i 0.065
p 2
i 0
A B C D E F G H I J K L M N 0 P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
The Hill Cipher
Example:
• Encrypting a message using the Hill Cipher is very simple. Decryption however is more challenging.
• Suppose the key (K) is
• We are given the following plaintext “july”, we need to encrypt two pieces of plaintext ju (9,20) and ly (11,24):
7 18
k
23 11
11 8
9 20 99 60, 72 40 3, 4
3 7
and
11 8
11 24 121 72, 88 168 11 22
• After k-1 is found, it is easy to find the 3 7
corresponding
plaintext, which is “matrix” in our case.
The Hill Cipher
Example:
• To decrypt, we use K-1, following computation are made:
7 18
3 4 21 92, 54 44 9, 20
and 23 11
7 18
11 22
• Hence the correct plaintext is obtained
77 506, 198 242 11, 24
• In order to decrypt, it is needed 23
the 11 of K to satisfy:
determinant
gcd( det(K), 26) =1=(53, 26)
1
a b 1 d b
c d ad bc c a
Cryptanalysis of the Hill
Cipher
• The Hill Cipher is difficult to break using only ciphertex but it
can be easily broken using known plaintext attack
x 1 2 3 4 5 6 c 1 2 3 4 5 6
π(x) 5 1 6 3 2 4 π-1(c) 2 5 4 6 1 3
x 1 2 3 4 5 6
π(x) 3 5 1 6 4 2