Vigenère Cipher
Main Concept
The Vigenère Cipher is a simple form of polyalphabetic substitution through which alphabetic text is encrypted using a series of Caesar ciphers with different shift values based on the letters of a keyword. This encryption method is named after French diplomat and cryptographer Blaise de Vigenère, although it had been described centuries earlier by Italian cryptographer Giovan Battista Bellaso.
The Processes of Encryption and Decryption
To encrypt, you use a table of alphabets, known as a Vigenère table, Vigenère square, or a tabula recta, which consists of the alphabet written 26 times in different rows, with each alphabet shifted cyclically to the left compared to the one in the row above (this illustrates the 26 possible Caesar ciphers):
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
A A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
B B C D E F G H I J K L M N O P Q R S T U V W X Y Z A
C C D E F G H I J K L M N O P Q R S T U V W X Y Z A B
D D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
E E F G H I J K L M N O P Q R S T U V W X Y Z A B C D
F F G H I J K L M N O P Q R S T U V W X Y Z A B C D E
G G H I J K L M N O P Q R S T U V W X Y Z A B C D E F
H H I J K L M N O P Q R S T U V W X Y Z A B C D E F G
I I J K L M N O P Q R S T U V W X Y Z A B C D E F G H
J J K L M N O P Q R S T U V W X Y Z A B C D E F G H I
K K L M N O P Q R S T U V W X Y Z A B C D E F G H I J
L L M N O P Q R S T U V W X Y Z A B C D E F G H I J K
M M N O P Q R S T U V W X Y Z A B C D E F G H I J K L
N N O P Q R S T U V W X Y Z A B C D E F G H I J K L M
O O P Q R S T U V W X Y Z A B C D E F G H I J K L M N
P P Q R S T U V W X Y Z A B C D E F G H I J K L M N O
Q Q R S T U V W X Y Z A B C D E F G H I J K L M N O P
R R S T U V W X Y Z A B C D E F G H I J K L M N O P Q
S S T U V W X Y Z A B C D E F G H I J K L M N O P Q R
T T U V W X Y Z A B C D E F G H I J K L M N O P Q R S
U U V W X Y Z A B C D E F G H I J K L M N O P Q S R T
V V W X Y Z A B C D E F G H I J K L M N O P Q S R T U
W W X Y Z A B C D E F G H I J K L M N O P Q S R T U V
X X Y Z A B C D E F G H I J K L M N O P Q S R T U V W
Y Y Z A B C D E F G H I J K L M N O P Q S R T U V W X
Z Z A B C D E F G H I J K L M N O P Q S R T U V W X Y
At each point in the encryption, the cipher uses a different alphabet from one of these rows, depending on the corresponding letter of the repeated keyword.
After creating the original message (the "plaintext"), you must choose a keyword and repeat it until it matches the length of the plaintext (the "key"). In the Vigenère square, each row begins with a key letter. Even though there are 26 rows displayed, you only use the rows which correspond to the unique letters in the key.
For example: If the message to be encrypted is "GOODMORNING" and the keyword is "HELLO" then the plaintext and key are written as follows:
GOODMORNING
HELLOHELLOH
For successive letters of the message, take successive letters of the key and encrypt each plaintext letter using its corresponding key row as a Caesar cipher . That is, take the first letter of the key, move down to the row whose heading matches that letter, move along that row to the column whose heading matches the first letter of the plaintext, and then take the letter at the intersection of [key-row, message-column] to be the encrypted letter. Repeat this process with the remaining letters in the plaintext and key until you have encrypted every letter of the original message.
For example: The first letter of the plaintext, G, is paired with the first letter of the key, H. To encrypt G, look along the row beginning with H and find the column with the heading of G. The intersection of the H-row and G-column gives you the first letter of the ciphertext, N. Repeating this with the second letter of the plaintext, O, which is paired with E from the key, we find that the second letter of the ciphertext is S (the intersection of the E-row and O-column). This process continues until every letter in the plaintext has been encoded in this way:
NSZOAVVYTBN
To decrypt the ciphertext, you must first know the key that was used to encrypt the message, and you then work backwards through the encryption procedure. That is, beginning with the first letter of the key, find the row whose heading matches that letter, move along the row until you find the position of the first ciphertext letter in that row, and then take the letter from the heading of this column to be the plaintext letter. This process is repeated with the remaining letters of the ciphertext and key until every letter of the ciphertext is decrypted.
For example: The first letter of the ciphertext, N, is paired with the first letter of the key, H. So, to decrypt N, we look along the row beginning with H and find the position of N in this row. The letter at the top of the column which intersects the H-row at N is G, and so we take G to be first letter of the plaintext. Repeating this with the second letter of the ciphertext, S, which is paired with E from the key, we find that the second letter of the plaintext is O (the header of the column which intersects the E-row at S). This process continues until every letter in the ciphertext has been decoded in this way.
Algebraic Description
As with the Caesar cipher, encryption using a Vigenère cipher can also be described using modular arithmetic by first transforming the letters of the alphabet into numbers with A = 0, B = 1, C = 2, ... , Y = 24, Z = 25.
Vigenère encryption, E, using the key K can then be represented as
Ci = EKMi = Mi + Ki mod 26
and Vigenère decryption, D, using the key K can be represented as
Mi = DKCi = Ci − Ki mod 26
where M = M0... Mn is the plaintext message, C = C0 ... Cn is the ciphertext and K = K0 ... Km is the used key.
Like all polyalphabetic ciphers, the idea behind the Vigenère cipher is to disguise plaintext letter frequencies, thereby interfering with the straightforward application of frequency analysis. In the past, this cipher was believed to be unbreakable, earning it the description "le chiffre indéchiffrable", which means "the indecipherable cipher" in French. This claim proved to be false, as it has been shown that Kasiski examination, the Friedman test, Kerckhoff's method, and key elimination can all be used to break simple Vigenère ciphers. Having a "running" key which is at least as long as the plaintext helps to strengthen your encryption by ensuring that the key is not repeated and preventing patterns from forming in the ciphertext, in which case Kasiski examination and the Friedman test no longer work. Theoretically, if a key is truly random, at least as long as the plaintext, and used only once, the Vigenère cipher should be unbreakable. This situation is, however, highly unlikely.
Type the message you would like to encrypt and the alphabetic key you would like to use in the text boxes below, and then click the "Enter Plaintext" and "Enter Key" buttons. The box below will display your plaintext in black, the encryption key in dark blue, and the ciphertext in red. Try using both long and short keys to see which variant produces ciphertext with fewer repetitions and patterns (and is therefore harder to break).
Plaintext
Key
More MathApps
MathApps/ComputerScience
Download Help Document