Vigenère Cipher
Shift each letter by a different amount, driven by a repeating keyword.
walkthroughWatch it work, step by step
Keyword “LEMON” repeats across the message
Write the keyword under the plaintext, repeating it. Each plaintext letter is shifted forward by its key letter (A = 0, B = 1, …).
Overview
The Vigenère cipher is polyalphabetic: rather than one fixed shift, it uses a keyword whose letters give a sequence of shifts. Write the keyword repeatedly beneath the message, then shift each plaintext letter forward by the value of the key letter above it.
Because the shift changes from position to position, the same plaintext letter can become several different ciphertext letters. This defeats the simple frequency analysis that breaks monoalphabetic ciphers like Caesar and Affine.
History
The method was first described by Giovan Battista Bellaso in 1553, but was later misattributed to Blaise de Vigenère, whose name stuck.
For three centuries it was reputed unbreakable, earning the nickname “le chiffre indéchiffrable” (the indecipherable cipher). It was widely used, including by the Confederate Army during the American Civil War.
Weaknesses
Charles Babbage (c. 1854) and Friedrich Kasiski (1863) independently broke it: repeated substrings in the ciphertext reveal the key length, after which the message splits into several Caesar ciphers — one per key position — each solvable by frequency analysis.
A short key relative to the message is the fatal flaw. The shorter and more repetitive the key, the more structure leaks. (When the key is truly as long as the message and never reused, it becomes the One-Time Pad — which is unbreakable.)
Implementation notes
Only letters are enciphered; case is preserved and other characters pass through. Non-letters do not consume a key letter, keeping the key aligned to the letters of the message.