The Playfair Cipher
The Playfair cipher was invented by Sir Charles Wheatstone and popularized by Baron Lyon Playfair. It is relatively easy to learn and to use with only pencil and paper. It was used during combat in WWII for messages who’s relevance was short lived.
I enjoy this cipher mainly because traditionally it’s written down in pairs of letters which makes it easy recognize from just looking at the cipher text what method you’ll need to use to decipher.
The Playfiar cipher is a digraph cipher which replaces one pair of letters with another pair of letters.
To encrypt something with the Playfair cipher you must first decide on a keyword. Lets use: SECRET
Then take the keyword and write it into a 5 x 5 grid followed by the rest of the alphabet (skipping any repeated letters) with J and I being the same:
SECRT
ABDFG
HIKLM
NOPQU
VWXYZ
Then take your message and split it in to pairs of letter. Each pair must contain different letters, so if a pair has two of the same letter add an ‘X’ between them. If there are not an even number of letters add an ‘X’ to the end. For example:
WE WILL ATTACK AT DAWN
becomes:
WE WI LX LA TX TA CK AT DA WN
Now, to encipher use the following rules:
1. If a pair of letters are on the same row, replace them with the letters to the right of the original letters warping around to the left if the original letters are on the far right.
2. If a pair of letters are on the same column, replace them with the letters to the bottom of the original letters warping around to the top if the original letters are on the very bottom.
3. If the pair are not on the same row or on the same column then take the first letter and follow along it’s row until you find the column of the second letter and replace it with the letter at this intersection. For the second letter follow allow it’s column until you find the row of the first letter and replace it with the letter at this intersection.
For a good example of this process check out the Wikipedia entry here: https://en.wikipedia.org/wiki/Playfair_cipher#Example
For our example above:
WE WI LX LA TX TA CK AT DA WN
becomes:
EB EO KY HF CZ SG DP GS FB VO
To decipher you can reverse the process using the rules above.