The Vigenère cipher
The Vigenère cipher improves on the Caesar cipher by using a keyword instead of one fixed shift. Each letter of the keyword sets the shift for one letter of the message, and the keyword repeats along the text. Described by Giovan Battista Bellaso in 1553 and later named after Blaise de Vigenère, it resisted code-breakers for about 300 years and was known as le chiffrage indéchiffrable, "the indecipherable cipher".
How to use it
- Type your message and a keyword, such as LEMON.
- Choose Encrypt or Decrypt. The person receiving the message must use the same keyword to decrypt it.
- Read the working to see which shift was applied to each letter.
How it works
Each keyword letter is turned into a shift: A = 0, B = 1, … Z = 25. Only letters use up keyword letters; spaces and punctuation are skipped and kept.
encrypt: Ci = (Pi + Ki) mod 26
decrypt: Pi = (Ci − Ki) mod 26
Classic example
| Plain text | A T T A C K A T D A W N |
|---|---|
| Keyword | L E M O N L E M O N L E |
| Cipher text | L X F O P V E F R N H R |
Notice that the three letter A's in the message become L, O and N. Because the same letter is encrypted differently, simple letter-frequency analysis does not work, which is what made the cipher so strong for its time.
How it was finally broken
In the 1850s and 1860s, Charles Babbage and Friedrich Kasiski showed that repeated groups of letters in the cipher text reveal the length of the keyword. Once the length is known, the message splits into several simple Caesar ciphers that can each be solved by frequency analysis. Short keywords and long messages make this easy, so use it for puzzles and learning, not for real secrets.
Frequently asked questions
What makes a better keyword?
A long keyword with no repeating pattern. A random key as long as the message becomes a one-time pad, which is unbreakable if never reused.
Why is my keyword's number ignored?
Only letters A–Z count. Digits, spaces and symbols in the keyword are removed.
Is shift A really zero?
Yes. A keyword letter A leaves the message letter unchanged, just like a Caesar shift of 0.