The Vigenère cipher is a method of encryption invented by Blaise de Vigenère in the 1550s. The algorithm is a keyword-based system that uses a series of different Caesar ciphers based on the letters of the keyword. It is a simple and effective form of polyalphabetic substitution.
It functions as follows:
1. The encipherer chooses a piece of plaintext:
VIGENERE2. The encipherer chooses a keyword and repeats it to become the length of the ciphertext:
CIPHCIPH3. To encipher letter L1 of the plaintext, the encipherer creates a new alphabet wherein A is shifted to letter L1 of the ciphertext, B is shifted to the next letter, etc.:
ABCDEFGHIJKLMNOPQRSTUVWXYZ --> CDEFGHIJKLMNOPQRSTUVWXYZAB4. The encipherer finds the letter that corresponds to L1 in the new alphabet. This is now L1 of the plaintext:
V --> X5. This is repeated for each letter in the plaintext and its corresponding letter in the key:
VIGENERE + CIPHCIPH --> XQVLPMFLA simpler, but equivalent way to encode a message is to write out a copy of the alphabet, and then write the keyword vertically beneath the letter A. Then, starting with each letter, complete the alphabet (starting again with A after reaching Z). For example, if the keyword is "CUP", one would write:
ABCDEFGHIJKLMNOPQRSTUVWXYZ CDEFGHIJKLMNOPQRSTUVWXYZAB UVWXYZABCDEFGHIJKLMNOPQRST PQRSTUVWXYZABCDEFGHIJKLMNOTo encode a message, one locates the plaintext letter in the top row, and then reads the ciphertext letter from one of the alphabets below, using each one in turn. One can also write out the entire set of these shifted alphabets, picking the right row for any letter of the key, the resulting block of alphabets is known as a tabula recta. This use of multiple alphabets in rotation to encrypt a message is why this is called a polyalphabetic cipher.
The advantage of this cipher is that it defeats frequency analysis. Frequency analysis is the practice of decrypting a message by looking at the frequency of letters in the ciphertext, and comparing that with the frequency of letters in normal text. For instance if P occurred a lot in a ciphertext one could suspect that P corresponded to E, because E is the most frequently used letter in English. Using the Vigenere cipher, E can be enciphered as any letter in the alphabet in the Vigenere cipher, defeating frequency analysis.
This cipher was not actually the strongest one invented by Vigenère. He also invented an autokey cipher which mas much stronger than this one, but the name "Vigenère cipher" became associated with this polyalphabetic cipher instead. In fact the two ciphers were often confused, and both were cometimes called "le chiffre indéchiffrable", or "the unbreakable cipher". For nearly 300 years this cipher was thought to be unbreakable. But Charles Babbage and Friedrich Kasiski independently broke the cipher in the middle of the 19th century. Babbage actually broke the much stronger autokey cipher, while Kasiski is generally credited with the first published solution to fixed-key polyalphabetic ciphers.
The technique used to break it is described below. The weakness relies on the fact that the key is relatively short and constantly repeated: as a result, common words like "the" will eventually be encrypted using the same key letters, leading to repeated groups in the ciphertext. If the message is long enough, therefore, the following procedure can be used:
Modern attacks on polyalphabetic ciphers are essentially identical to that described above, with the one improvement of coincidence counting. Instead of looking for repeating groups, a modern analyst would take two copies of the message and lay one above another. (Actually, modern analysts use computers, but this description illustrates the method well.) The analyst then shifts the bottom message one letter to the left, then two letters to the left, etc., each time going through the entire message and counting the number of times the same letter appears in the top and bottom message. The number of "coincidences" goes up sharply when the bottom message is shifted by a multiple of the key length, because then the adjacent letters are in the same language using the same alphabet. Having found the key length, cryptanalysis proceeds as described above using frequency analysis.