Vigenère Cipher

Vigenère Cipher Square

Named after French diplomat, Blaise de Vigenère, the Vigenère cipher built on the work / ideas of Giovan Battista Bellaso. Previously I have looked at the Caesar cipher and included a Python program that can brute force crack the cipher. The Caesar cipher can be easily broken either via frequency analysis of letters or via brute force. The Vigenère cipher uses a series of interwoven Caesar ciphers to make decryption without the correct key harder than breaking a single Caesar cipher. The Vigenère cipher was first described in 1553 and was not (recorded as) broken until 1863 by Charles Babbage.

The Vigenère cipher is a polyalphabetic substitution cipher, which uses an alphabetic (letter) key instead of a number key (as used in the Caesar cipher). A longer Vigenère key is more secure and harder to crack than a short Vigenère key.

Vigenère Cipher Square
Vigenère Cipher Square

How it works:

To encrypt plain text, in this case the phrase “geektechstuff is awesome”, with the key “secretcodekey” we would look up each letter of the secret key in the alphabet running down the left hand side of the Vigenère square in sequence for each letter in the plain text.

The first letter of the plain text is “g“. The first letter of the Vigenère key is “s“. Finding “s” in the alphabet running down the left of the Vigenère square and the “g” on the alphabet running across the top of the square leaves us to find the letter that they intersect on, which is “y“.

geektechstuff_vigenere_square_example.jpg

The second letter of the plain text is “e“, the second letter of the Vigenère key is “e“. Finding “e” in the alphabet running down the left of the Vigenère square and the “e” on the alphabet running across the top of the square leaves us to find the letter that they intersect on, which is “i“.

The next letter in the plain text is “e” again, but the encrypted letter this time won’t be “i” as the letter in the Vigenère key has changed to “c“, which means the encrypted letter is “g“. This is a feature that gives the Vigenère cipher an advantage over the Caesar cipher, as the Caesar cipher would have encrypted the plain letter “e” as the same output.

Plain Text:

geektechstuffisawesome

Vigenère Key:

secretcodekey

Encrypted Text:

yigbxxevvxejdawcnilqah

What happens if the plain text is longer than the Vigenère key?

A Vigenère key may (and probably will) be smaller than the text it is encrypted. When the end of the key is reached it loops back to the beginning of the key. For example, our plain text (geektechstuffisawesome) contains 22 characters, our Vigenère key (secretcodekey) contains 13 characters, which is only enough to cover geektechstuff. For the “i” of “isawesome” the key starts again with the “s” of “secretcodekey” resulting in “i” being encrypted as “a“.

This is a weakness of the Vigenère cipher, as if a key is short and plain text letters are repeated (e.g. ed, ee, ea, th) regularly in the plain text then patterns start to form in the encrypted text that can hint at the length of the key.

For more information on the Cipher:

Wikipedia:

https://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher

Future Learn:

https://www.futurelearn.com/courses/encryption-and-cryptography

The Black Chamber:

https://www.simonsingh.net/The_Black_Chamber/vigenere_cipher.html

2 thoughts on “Vigenère Cipher

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.