The Playfair cipher was the first practical digraph substitution cipher. The scheme was invented in 1854 by Charles Wheatstone but was named after Lord Playfair who promoted the use of the cipher. In playfair cipher unlike traditional cipher we encrypt a pair of alphabets(digraphs) instead of a single alphabet
Information and network security 13 playfair cipher
1. Information and Network Security:13
Playfair Cipher
Prof Neeraj Bhargava
Vaibhav Khanna
Department of Computer Science
School of Engineering and Systems Sciences
Maharshi Dayanand Saraswati University Ajmer
2. 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
3. • Consider ways to reduce the "spikyness" of natural language text,
since if just map one letter always to another, the frequency
distribution is just shuffled. One approach is to encrypt more than
one letter at once. The Playfair cipher is an example of doing this,
treats digrams in the plaintext as single units and translates these
units into ciphertext digrams.
4. 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
5. • The best-known multiple-letter encryption cipher is the Playfair,
which treats digrams in the plaintext as single units and translates
these units into ciphertext digrams.
• The Playfair algorithm is based on the use of a 5x5 matrix of letters
constructed using a keyword.
• The rules for filling in this 5x5 matrix are: L to R, top to bottom, first
with keyword after duplicate letters have been removed, and then
with the remain letters, with I/J used as a single letter.
• This example comes from Dorothy Sayer's book "Have His Carcase", in
which Lord Peter Wimsey solves it, and describes the use of a
probably word attack.
6. 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 (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
7. • Plaintext is encrypted two letters at a time,according to the rules as shown. Note
how you wrap from right side back to left, or from bottom back to top.
• if a pair is a repeated letter, insert a filler like 'X', eg. "balloon" encrypts as "ba lx
lo on"
• if both letters fall in the same row, replace each with letter to right (wrapping
back to start from end), eg. “ar" encrypts as "RM"
• if both letters fall in the same column, replace each with the letter below it
(again wrapping to top from bottom), eg. “mu" encrypts to "CM"
• otherwise each letter is replaced by the one in its row in the column of the other
letter of the pair, eg. “hs" encrypts to "BP", and “ea" to "IM" or "JM" (as desired)
• Decrypting of course works exactly in reverse. Can see this by working the
example pairs shown, backwards.
8. Security of Playfair Cipher
security much improved over monoalphabetic
since have 26 x 26 = 676 digrams
would need a 676 entry frequency table to analyse (verses 26 for a
monoalphabetic)
and correspondingly more ciphertext
was widely used for many years
eg. by US & British military in WW1
it can be broken, given a few hundred letters
since still has much of plaintext structure
9. • The Playfair cipher is a great advance over simple monoalphabetic ciphers,
since there are 26*26=676 digrams (vs 26 letters), so that identification of
individual digrams is more difficult.
• Also,the relative frequencies of individual letters exhibit a much greater
range than that of digrams, making frequency analysis much more difficult.
• The Playfair cipher was for a long time considered unbreakable. It was used
as the standard field system by the British Army in World War I and still
enjoyed considerable use by the U.S.Army and other Allied forces during
World War II.
• Despite this level of confidence in its security, the Playfair cipher is
relatively easy to break because it still leaves much of the structure of the
plaintext language intact. A few hundred letters of ciphertext are generally
sufficient.