The Vigenère Cipher
The Vigenère cipher is a type of polyalphabetic substitution cipher. This means that unlike ciphers such as the Caesar cipher, each letter is not encoded using the same shift or rule for substitution.
Leon Battista Alberti in the mid 15th century wrote about an early version of what we now call the Vigenère cipher. He used a cipher disc to encode and decode messages. This cipher changed the substitution alphabet occasionally, marking the new alphabet in the ciphertext. Imagine a Caesar cipher in which the shift is denoted by a letter. The letter "A" means a shift of 0, "B" a shift of one, and so on. If you encoded text using a Caesar cipher, changing the shift after a sentence and writing down the new key letter, that would be a pretty good recreation of Alberti's cipher.
Clearly, if we know the system, the ciphertext contains enough information for us to decode it. It relied on what we call "security through obscurity", as many early ciphers did.
Later, at the beginning of the 16th century, Johannes Trithemius developed a cipher in which the alphabet changed for each letter. It would progress through a series of alphabets, each essentially a Caesar shift with the shift going up by one each time. He also produced what he called the "Tabula Recta" - a table of these alphabets, which can be used to encipher the messages - just like the one below. For each letter in the plain text, you trace along its row until you reach the current alphabet column - start with the first column, then the second, and so on.
Giovan Battista Bellaso, in the middle of the 16th century created what we now know as the Vigenère cipher. Building on the previous work, Bellaso introduced the idea of a key (although he called it a "countersign") that would dictate the alphabet used to encode each letter.
We know this cipher as the Vigenère cipher due to a slight mistake in attribution. Later in the 16th century, Blaise de Vigenère created a new, and actually more secure, variation on Bellaso's cipher. Unfortunately, a few hundred years later the Bellaso cipher was recorded as the work of Vigenère and although we now know the mistake, the name has stuck.
Encoding with the Vigenère Cipher
Encoding and decoding using this cipher is not difficult, but at first it was considered more effort than necessary. Only when it became clear that all of its predecessors were being routinely broken by cryptanalysts did people choose to use the Vigenère cipher. At the time, it was considered unbreakable.
To encode a message we follow these simple steps:
- Look at the current character in the plain text. This will be the first character to begin with.
- Look at the current character of the key. This will be the first character in the key to begin with.
- Use the table of alphabets (the Tabula Recta - below) to find the character where the column corresponding to the key and the row corresponding to the plain text characters intersect. Record this as the next character of ciphertext.
- Move to the next key character (going back to the start if there are no more) and the next plain text character (if there is one) and go back to step 1
Let's see how this works by encoding "Mary had a little lamb", with the key "cobalt". We won't encode punctuation or spaces and we will ignore case, so our two strings are: MARYHADALITTLELAMB and COBALT.
The current character of plaintext is M and of the key is C:
Use these two letters as coordinates in the table below. Find the row with the letter M and the column with the letter C, then trace across and down to where that row and column intersect to find the first ciphertext letter: O
Now we move to the next pair of letters.
This time, the ciphertext is also O. This illustrates the big advantage that polyalphabetic ciphers have over monoalphabetic ciphers: finding two identical ciphertext letters doesn't mean you've found two identical plaintext letters. Conversely, a pair of identical letters in the plaintext won't be necessarily encoded as the same ciphertext letter. When it was invented, this property thwarted all of the existin cryptanalysis techniques and led to it being known as the indecipherable cipher.
Vigenère Encoding Tool