Playfair

The Playfair cipher was invented by a rather clever chap by the name of Wheatstone. Playfair's name is attached to it as he is the one who was a vocal supporter of it in government circles. Sir Charles WheatstoneHistory is funny like that.

Playfair first demonstrated this cipher at a dinner in 1854. The dinner was given by a lord Granville, and a notable guest was Lord Palmerston.

The cipher is a form of monoalphabetic substitution, but relies on DIGRAPHS rather than single letters - and it is simple to master. The playfair cipher is believed to be the first digraphic system.

Again, we start with a keyword and then place the remaining letters in a 5x5 square - for instance using "cryptogram" as a keyword we obtain:

CRYPTOGAM
BDEFHIKLN
QSUVWXZ--

This can be read of by columns:

CBQRDSYEUPFVTHWOIXGKZALMN

and then placed into a 5 by 5 square:

C  B  Q  R  D
S  Y  E  U  P
F  V  T  H  W
O IJ  X  G  K
Z  A  L  M  N

Note that I and J are entered into the same cell. This system of generating the square degenerated into simply entering the keyword directly into the 5 by 5 square (this is the method we shall use for demonstration purposes, however you should be aware that ANY method of placing letters into the grid may be used).

Playfair demonstrated this system at the party by using the keyword Palmerston.

P  A  L  M  E
R  S  T  O  N
B  C  D  F  G
H IJ  K  Q  U
V  W  X  Y  Z

To encipher some text, that text must first be split into digraphs - double letters are seperated, here I've used an x - so each bigraph will consist of different letters. If it turns out that the last letter is on its own an x is added to the end of the message.

So the message "Lord Granville's dinner party", when split into digraphs will become lo rd gr an vi lx le sd in ne rp ar ty.

Now the text is ready to encipher. For example, in order to encipher ay we must locate a and y in the square, and find the letter which is in the same row as a and the same column as y.

P  A  L  M  E
.  .  .  O  .
.  .  .  F  .
.  .  .  Q  .
.  .  .  Y  .

Hence the first letter of the enciphered digraph is M, the second letter is found by examining the column containing the first letter and the row containg the second.

.  A  .  .  .
.  S  .  .  .
.  C  .  .  .
. IJ  .  .  .
V  W  X  Y  Z

So the second letter is W. Therefore ay becomes MW. You may like to think of this by imagining the plaintext letters as being one corner of a rectangle, and the ciphertext letters as being the other corners of the rectangle.

What happens if the two letters fall in the same row or column? If they fall in the same row then the letters to the right are taken, and if they fall in the same column then the letters underneath are taken.

Note that the table "wraps", so Y is to the right of X, Z is to the right of Y, and V is to the right of Z. Thus el becomes PM. Note that the order of the letters in the digraph is important and should be preserved.

Using these rules the message "Lord Granville's Dinner Party" is encoded as follows:

lo rd gr an vi lx le sd in ne rp ar ty
MT TB BN ES WH TL MP TC US GN BR PS OX

and becomes "MTTBBNESWHTLMPTCUSGNBRPSOX". (Note the encoding of LX to avoid a double letter). To decode the same rules are used in reverse.

What are the advantantages of such a system?

The prime reason is that one of the main weapons of the cryptanalyst is weakened. You will have noticed for example, that the letter "e" does not always encipher to the same letter - how it enciphers depends upon what it is paired with - much more ciphertext must be obtained in order to make use of digraphic frequency analysis (and there are many more digraphs than single letters). In other words it COULD be broken using the same techniques as a single-letter monoalphabet, but we'd need more text. (Note that this is not the best way to crack playfair!)

Also we now have less elements available for analysis in a 100 letter message enciphered using a single letter substitution we have 100 message elements (from a choice of 26) for analysis - if the message had been enciphered using digraphs then we'd only have 50 message elements (from a choice of 676).

The cipher had many advantages, no cumbersome tables or apparatus was required, it had a keyword which could be easily changed and remembered and it was very simple to operate. These considerations lend the system well to use as a 'field cipher'.

Apparently Wheatstone and Playfair presented this system to the Foreign office for diplomatic use, but it was dismissed as being too complex. Wheatstone countered by claiming that he could teach three schoolboys out of four to use the system in less that fifteen minutes - the under secretary at the FO replied "That is very possible, but you could never teach it to attachés."

The cipher was mentioned at Granville's party with a view to its use in the Crimea. The system was not used in the Crimean war, but there are reports that it served in the Boer war.