# Vigenère Cipher

A Vigenère cipher is a type of substitution cipher; The letters of the message are shifted down the alphabet based on the key used. The first letter of the plaintext is shifted by the first letter of the key, the second by the second, and so on. If the key used is shorter than the length of the plaintext, then when the end of the key is reached the cipher starts back at the beginning of the key. The Vigenère cipher can be encrypted and decypted using the tabula recta, a table of shifted alphabets. This method dictates that when encrypting plaintext, the key assigns "A" the value of 0, "B" the value of 1, "C" the value of 2, etc, instead of starting at A=1.

As an example, if you wanted to encrypt the message "HELLO" with the key "CAT", you would start by shifting the letter H down the alphabet. The first letter of our key is "C", which has a value of 2. H+2=J. The second letter, "E", would be shifted by 0, as "A" does not shift the plaintext. E+0=E. "T" has the value of 19, L+19=E. Now that the key has run out of letters, we start back at the beginning of the key and end up with L+2=N and O+0=O. Our end result of encrypting "HELLO" with the key "CAT" is "JEENO". To decrypt the ciphertext message back, you would perform this in reverse using the same key: J-2=H.

The Vigenère cipher works with any collection of unique characters, not just the English alphabet. In 2014 there were two pages of the Liber Primus encrypted using a Vigenère cipher with the gematria primus as the alphabet. This meant that the runes had to be shifted following the Vigenère cipher method prior to being translated into English.

Key:
Plaintext:

Ciphertext: