Search
Vigenère Cipher

The Vigenère Cipher

The Vigenère cipher was invented by Giovan Battista Bellaso in 1553. Sometime later in history it was misattributed to a different person, Blaise de Vigenère, likely due to his improvement of the cipher he published in 1586 known as the Autokey variant. His name has stuck with the cipher ever since.

Enciphering a Message

To encipher a message, first choose a word of phrase as the keyword for the message. For example, UNICORN. Repeatedly write this keyword over your plaintext message until your keystream is equal in length to your plaintext. We'll use a piece of a quote from Blaise de Vigenère himself:

I saw Michelangelo at work. He had passed his sixtieth year and although he was not very strong, yet in a quarter of an hour he caused more splinters to fall from a very hard block of marble than three young masons in three or four times as long.

keystream: UNICORNUNICORNUNICORNU
plaintext: isawmichelangeloatwork

Then, proceed in a similar fashion as the Trithemius cipher, either using the tabula recta or mathematical approach with the Caesar cipher.

 keystream: UNICORNUNICORNUNICORNU
 plaintext: isawmichelangeloatwork
ciphertext: CFIYAZPBRTCBXRFBIVKFEE

Deciphering a Message

Generate a keystream in the same way as when you're enciphering written over the ciphertext, and decipher in the same way as other tabula recta based ciphers.

Frequency Analysis

Looking at different length keys, see if you can spot a pattern in the resulting bar charts describing the ciphertext letter frequencies.

Using the text of Pride and Prejudice and a keyword of UNI.

Using the text of Pride and Prejudice and a keyword of UNIS.

Using the text of Pride and Prejudice and a keyword of UNICORNS.

We can see that each time the keyword increases in length, the more uniform the frequency distribution becomes. That is, the more even the bars are to each other. While we will likely never obtain a perfectly uniform distribution where each bar has a height of $\frac{1}{26} \approx 0.03846$ or $3.846 \%$, it seems like the longer the keyword the closer we get to perfectly hiding the letter frequency. Unfortunately, remembering a really long keyword isn't the easiest thing to do. However, Blaise de Vigenère's improvement to this cipher that generates a long keyword from a short one is the reason why people attribute this cipher to him, and it will be covered in the next section.

Exercise for the Reader

Can you program a Vigenère encipher and decipher function? You can use the Trithemius cipher program as a starting point.