CH 02
CH 02
Network Security
Chapter 2
Fourth Edition
by William Stallings
Plain: abcdefghijklmnopqrstuvwxyz
Key : DKVQFIBJWPESCXHTMYAUOLRGZN
Plaintext: ifwewishtoreplaceletters
Ciphertext: WIRFRWAJUHYFTSDVFSFUUFYA
Monoalphabetic Cipher
Security
now have a total of 26! ≈ 4 x 1026keys
with so many keys, might think is secure
but would be !!!WRONG!!!
problem is language characteristics
Language Redundancy and
Cryptanalysis
human languages are redundant
eg "th lrd s m shphrd shll nt wnt"
letters are not equally commonly used
in English E is by far the most common letter
followed by T,R,N,I,O,A,S
other letters like Z,J,K,Q,X are fairly rare
have tables of single, double & triple letter
frequencies for various languages
English Letter Frequencies
Use in Cryptanalysis
key concept - monoalphabetic substitution
ciphers do not change relative letter frequencies
discovered by Arabian scientists in 9 th century
calculate letter frequencies for ciphertext
compare counts/plots against known values
if caesar cipher look for common peaks/troughs
peaks at: A-E-I triple, NO pair, RST triple
troughs at: JK, X-Z
for monoalphabetic must identify each letter
tables of common double/triple letters help
Example Cryptanalysis
given ciphertext:
UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZ
VUEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSX
EPYEPOPDZSZUFPOMBZWPFUPZHMDJUDTMOHMQ
count relative letter frequencies (see text)
guess P & Z are e and t
guess ZW is th and hence ZWP is the
proceeding with trial and error finally get:
it was disclosed yesterday that several informal but
direct contacts have been made with political
representatives of the viet cong in moscow
Playfair Cipher
not even the large number of keys in a
monoalphabetic cipher provides security
one approach to improving security was to
encrypt multiple letters
the Playfair Cipher is an example
invented by Charles Wheatstone in 1854,
but named after his friend Baron Playfair
Playfair Key Matrix
a 5X5 matrix of letters based on a keyword
fill in letters of keyword (sans duplicates)
fill rest of matrix with other letters
eg. using the keyword MONARCHY
M O N A R
C H Y B D
E F G I/J K
L P Q S T
U V W X Z
Encrypting and Decrypting
plaintext is encrypted two letters at a time
1. if a pair is a repeated letter, insert filler like 'X’
2. if both letters fall in the same row, replace
each with letter to right (wrapping back to start
from end)
3. if both letters fall in the same column, replace
each with the letter below it (again wrapping to
top from bottom)
4. otherwise each letter is replaced by the letter
in the same row and in the column of the other
letter of the pair
Example playfair cipher
Key: monarchy
Plaintext: instruments
For example:
PlainText: "instruments"
After Split: 'in' 'st' 'ru' 'me' 'nt' 'sz‘
1. Pair cannot be made with same letter. Break the letter in single and add a
bogus letter to the previous letter.
2. If the letter is standing alone in the process of pairing, then add an extra bogus
letter with the alone letter
•Ifboth the letters are in the same column: Take the letter below each
one (going back to the top if at the bottom).
For example:
•Ifboth the letters are in the same row: Take the letter to the right of
each one (going back to the leftmost if at the rightmost position).
For example:
•If neither of the above rules is true: Form a rectangle with the two
letters and take the letters on the horizontal opposite corner of the
rectangle.
For example:
Solution:
(repeated/
omitted
letters in
red)
The message "hide the gold in the tree stump" is to convert it to the pairs of
letters "HI DE TH EG OL DI NT HE TR EX ES TU MP" (with the null "X" used to
separate the repeated "E"s).