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.
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“.
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.
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:
The Black Chamber:
2 thoughts on “Vigenère Cipher”
Comments are closed.