Playfair cipher
The Playfair cipher encrypts letters two at a time using a 5 × 5 square built from a keyword. Working in pairs hides single-letter patterns, which made it much stronger than the substitution ciphers before it.
A little history
Charles Wheatstone invented the cipher in 1854, but it's named after his friend Lord Lyon Playfair, who promoted it to the British government. The British army used it in the Boer War and the First World War, because it was quick to use in the field with nothing but a pencil. In 1943, a coastwatcher's Playfair message helped rescue the crew of PT-109, the patrol boat commanded by the future US president John F. Kennedy.
How it works
First build the square: write the keyword's letters (dropping repeats), then the rest of the alphabet, with I and J sharing a cell. Here is the square for the keyword CRANE:
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| 1 | C | R | A | N | E |
| 2 | B | D | F | G | H |
| 3 | I/J | K | L | M | O |
| 4 | P | Q | S | T | U |
| 5 | V | W | X | Y | Z |
Then split the message into pairs (adding an X to finish an odd one) and encrypt each pair with three rules:
- Same row: take the letter to the right of each (wrapping round).
- Same column: take the letter below each (wrapping round).
- Otherwise: the two letters mark the corners of a rectangle; take the other two corners, staying in each letter's own row.
WATERWA TE RXXR UN AWDecrypting reverses the rules: left instead of right, up instead of down; the rectangle rule is its own reverse.
How to crack it
Playfair hides single-letter frequencies, but pairs still have them: TH, HE and ER are common in English, and their encrypted forms show up as common pairs in the ciphertext. A pair and its reverse (AB and BA) encrypt to reversed pairs, and a letter never encrypts to itself. With a long enough message, a codebreaker can rebuild the square piece by piece.
Playfair in Cyrune
The five-letter word gets an X on the end to make three pairs, so there are six lamps, and the sixth must decode to the padding X. Pin letters you know (green tiles pin themselves), then Test keywords: it tries every common five-letter word as the keyword and lists the ones that fit.
Related ciphers
- Bifid cipher ★★★★★
- Polybius square ★★★★☆
- Keyword cipher ★★★★☆