The Playfair square
A five by five square is filled with the letters of a keyword, without repeating them, then with the rest of the alphabet. There are only 25 cells: I and J share one.
The rule for pairs
The message is cut into pairs. A doubled letter within a pair is split by an X, and a lonely last letter is completed. If both letters are on the same row, each takes its right-hand neighbour. In the same column, the one below. Otherwise they swap columns.
With the key “playfair example”, “Hide the gold in the tree stump” becomes BM OD ZB XD NA BE KU DM UI XM MO UV IF. To decrypt, the same rules are applied backwards.
A bit of history
Devised by Charles Wheatstone in 1854, the cipher bears the name of his friend Lord Playfair, who championed it. Armies used it because it can be worked by hand.
Its limits
Digits, accents and punctuation vanish, and today it is easily broken. To protect information, use AES.
Frequently asked questions
Why do X letters appear?
They split doubled letters and complete the last pair. Decryption cannot tell which ones were in the original.
What happens to J?
It is treated as an I.
Why is my message rejected?
An encrypted message has an even number of letters, no digits or signs, and no pair of identical letters.
Is my key saved?
No. It stays in the page and is neither sent nor kept.
How do I decrypt by hand?
Rebuild the square with the keyword, cut the message into pairs, then apply the rules backwards: on the same row take the letter to the left; in the same column the one above; otherwise the corners of the rectangle, as when encrypting.