How the Vigenère cipher works
Write the keyword repeatedly under the message. Each keyword letter tells you how far to shift the letter above it: A shifts by 0, B by 1, C by 2 and so on up to Z, which shifts by 25. Here is the classic example with the keyword LEMON:
| Message | A | T | T | A | C | K | A | T | D | A | W | N |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Key | L | E | M | O | N | L | E | M | O | N | L | E |
| Cipher | L | X | F | O | P | V | E | F | R | N | H | R |
A shifted by L (11) becomes L, T shifted by E (4) becomes X, and so on. To decrypt, shift each letter back by the same amount. Notice that the two Ts in ATTACK become different letters (X and F); this hides the letter patterns that make a Caesar cipher so easy to break.
Choosing a good key
- Longer keys are much stronger. A key as long as the message, used only once, cannot be broken (this is called a one-time pad).
- Avoid common words: codebreakers try dictionary words first.
- Both people need the same key, so share it separately from the message.
History: the "indecipherable cipher"
For about three centuries the Vigenère cipher had a reputation as le chiffre indéchiffrable, the indecipherable cipher. Charles Babbage worked out how to break it in the 1850s but did not publish his method, and Friedrich Kasiski published a general attack in 1863. Variants were still used in the American Civil War and in early 20th-century military messages. Today it is a classic for puzzle hunts, escape rooms and anyone learning cryptography.