Playfair Cipher
The Playfair cipher was invented by Charles Wheatstone, but it was championed by the Postmaster General, Lord Playfair. It is monoalphabetic in nature, but is based upon pairs of letters rather than individual letters. Instead of 26 options, we have some 650, and this makes letter analysis more difficult
The cipher was originally deemed ‘too complex’ for use by the Foreign Office, but it was demonstrated that it could be taught to schoolboys in fifteen minutes. This earned the reply ‘That is very possible, but you could never teach it to attachés’. However, the code was adopted, and was used for for important but non-critical tactical messages (such as ‘advance at 8am’) as by the time the enemy could decrypt it, the information would be useless.
It is not longer considered secure, as a computer could decipher the text very quickly (especially if given a sizeable quantity of text).
The cipher works by choosing a keyword, and then using that to fill out a 5 by 5 grid. No letters repeat, and ‘J’ is subsumed into ‘I’.
If the key was ‘REALLYSECUREKEY’, then it’d be abridged as ‘REALYSCUK’ - repeated letters are removed.
This is then written into a 5x5 grid with some agreed method.
Suppose that we need to encode: “This is a secret message, a super secret message”
We take the letters pairwise, any double letter is separated with a dummy letter (typically X or Q).
We get: “TH IS IS AS EC RE TM ES SA GE AS UP ER SE CR ET ME SX SA GE “
Now the fun starts. Using the grid about, we look up each pair. If they form the corners of a rectangle (like TH) then we move along the row to read off the other corners (XD). In this way THIS become XDDB
If we have letters sharing a row or column, we slide along, in the direction they’re lined up. EC shares a column, so we slide each letter down a column to get CF.
Similarly, RE slides along the row to get EA.
If sliding along takes us ‘offgrid’ we come back on the other side, so TM becomes RT.
Note the order of letters is preserved, SK would become CB and KS would become BC. SH would be KD and HS would be DK, etcetera.
We continue in this way, and our final result is:
“XD DB DB RU CF EA RT RC UR FA RU KO AE CR SE RV NR KT UR FA “
I’ve written some code for this, i’ll put that in a separate post.
I’ll put the plaintext, the encrypted text, and the key grid all together at the foot of this post so that you can easily see it all at once.
Recent Cryptography Posts
Here’s the message, ciphertext and key grid
TH IS IS AS EC RE TM ES SA GE AS UP ER SE CR ET ME SX SA GE
XD DB DB RU CF EA RT RC UR FA RU KO AE CR SE RV NR KT UR FA