Vigenère


The Vigenère Cipher is essentially a repeating application of Caesar ciphers. It consists of many different alphabets, which is why we consider it polyalphabetic, unlike Atbash, Caesar, and Substitution ciphers, which are monoalphabetic. Vigenère is special since it is an incredibly simple cipher to understand, but it took around three centuries for cryptanalyists to break it. It was considered so unbreakable, it earned the nickname Le Chiffre Indéchiffrable, which translates from French to "The Indecipherable Cipher".

Vigenère was developed in the 16th Century, but its name derives from Blaise de Vigenère, who created a stronger version of it in the 19th Century. It wouldn't be until 1863 that Friedrich Kasiski would publish a method of breaking Vigenère.


Encoding Vigenère

Using the table, you can see that Vigenère essentially consists of multiple different Caesar ciphers in a row. Vigenère gains it strength by using more than one Caesar cipher and using a "key", which is a word or phrase used to encipher and decipher the message.

Let's go through an example of encrypting Vigenère. The text we wish to encrypt is "HELLO WORLD". We will be using the key "CRYPTO". First, we write CRYPTO over and over until every letter in HELLO WORLD has a corresponding key letter, while keeping spaces clear.

Plaintext:  HELLO WORLD
Key: CRYPT OCRYP

Next, we consult the chart. Take the first letter of the plaintext. In our case, that is H. Go to the COLUMN - the top side - that begins with H. Then, take the corresponding letter of the key. In our case, that is C. Go down to the ROW who begins with an C. This is not the row in colulmn H that has a C, but the row that has a C in the far left. Take the letter in that square. In our case, that would be a J. Continue doing this for each letter-key pair. You should get this back:

Plaintext:  HELLO WORLD
Key: CRYPT OCRYP
Ciphertext: JVJAH KQIJS

You should now be able to see Vigenère's advantage over monoalphabetic ciphers - look at the double L's in HELLO. Note how both of them encrypted to separate letters. This means that frequency analysis won't work on Vigenère encrypted messages.

Decoding Vigenère

Decrypting Vigenère is about as easy as encryption, just backwards. First, write the key over and over again until each encrypted letter has a key paring. To decrypt, we begin on the left side - the rows. Find the one that matches the first letter of the key. Then, move to the right until you find the first letter of the encrypted message IN THE KEYLETTER ROW - unlike encryption, this is not the column that contains the letter. Then, you move up and find the letter for the corresponding column you are in. In our case, that is an H. Continue for each key-letter pair. You should get "HELLO WORLD" back.

Breaking Vigenère - The Kasiski Method

Unfortunately, the Kasiski method, also used by Charles Babbage, is not a method of breaking Vigenère, but it can help an cryptanalyst determine the length of the key used. The Kasiski method relies on the fact that the key repeats itself over the length of the passage. Therefore, by chance, some parts will be encrypted in the exact same way. Kasiski proposed that if we count the letters starting from the first letter of the repeated phrase to the letter before the start of the second repeated phrase, and then took the factors of that gap, we could determine the length of the key.

For example, take the phrase, "THE SUN AND THE MAN IN THE MOON" and the key "KING". Spaces have been removed to keep clarity.

Plaintext:  THESUNANDTHEMANINTHEMOON
Key: KINGKINGKINGKINGKINGKING
Ciphertext: DPRYEVNTNBUKWIAOXBUKWWBT

Note that since the "THE" in the plaintext and the "ING" of the key managed to match up twice, "THE" ended up encoded to "BUK" twice. There are 8 characters between the beginning of the first BUK and the character before the last ("BUKWIAOX"). Taking the factors of this, we can guess that the key to the cipher is 8 letters, 4 letters, 2 letters, or one letter long. A 1 letter key would be a simple Caesar cipher. Since 1 and 2 letter keys are implausible (but not impossible), it is safe to assume the key is 8 or 4 letters long, which it is. As you could guess, the Kasiski method is much more effective with longer passages than shorter ones, since the possibility of a repitition is made higher with a longer message.

Vigenère Table

Vigenère Table

Vigenère Example

Plaintext:  CRYPTOLOGY IS COOL
Key: KEYKEYKEYK EY KEYK
Ciphertext: MVWZXMVSEI MQ MSMV

Practice with Vigenère

Example 1: Encipher "PA COMPUTER SCIENCE FAIR" with the key "WEBSITE"
Example 2: Encipher "WYOMISSING AREA HIGH SCHOOL" with the key "WYO"
Example 3: Decipher "WFUIERE VFAMRJ QAYEHDCDSZ PVBP QV MAYI SMVJ" with the key "ROME".
Example 4: Use Kasiski's method to determine the key length of "KSMEHZBBLKSMEMPOGAJXSEJCSFLZSY".
Paragraph: Decipher IZ SUQ CUF YIM SYW BS LHY VAQFS YSRFQ LCYHN
OHUL SI HRIMDFQ WY ZACDEX ST NZE NOIFAGBLS FSSN YLYSMCFG
QZOMW BLGAX KTLAPYK AHV BLAGBL SNSRM LHLG TBW PYJIFGUM XIAZT
IWR NZE LSMJSRNK WY OANUHYV WYJE MG GUDLUFTFQ SNJEUEIHY
AHV TBW RIUKYLS LWD ADALW, TBW BIEBM TULKTCFG CF ACJ
GUNE JJOIX TBJOOYH NZE HAGBL TBST IMR ZDAA OAM KTCDL NZELW
OB KAS VOYK TBST MLAL-KPUFGFWD VSNHWR SWT QSVY
GEL LHY DAHV OZ LHY XRYW AHV TBW HIEE IX TBW BLSVY? (key: "USA")
Example 1: LE DGUIYPIS KKBIJGF XIBV
Example 2: SWCIGGOGBC YFAY VEEV OAVKMZ
Example 3: FRIENDS ROMANS COUNTRYMEN LEND ME YOUR EARS
Example 4: 1, 3, or 9. The key is "RELATIONS" (9 letters).
Paragraph: OH SAY CAN YOU SEE BY THE DAWNS EARLY LIGHT
WHAT SO PROUDLY WE HAILED AT THE TWILIGHTS LAST GLEAMING
WHOSE BROAD STRIPES AND BRIGHT STARS THRO THE PERILOUS FIGHT
OER THE RAMPARTS WE WATCHED WERE SO GALLANTLY STREAMING
AND THE ROCKETS RED GLARE, THE BOMBS BURSTING IN AIR
GAVE PROOF THROUGH THE NIGHT THAT OUR FLAG WAS STILL THERE
OH SAY DOES THAT STAR-SPANGLED BANNER YET WAVE
OER THE LAND OF THE FREE AND THE HOME OF THE BRAVE?

Python Application of Vigenère


This application to come soon