﻿ Vigenère Cipher - A.Tools

Vigenère Cipher

Key

The Vigenère Cipher is a method of encrypting alphabetic text where each letter of the plaintext is encoded with a different Caesar Cipher, whose increment is determined by the corresponding letter of another text, the key. [Wikipedia]

The Vigenère Cipher is a polyalphabetic substitution cipher. The method was originally described by Giovan Battista Bellaso in his 1553 book La cifra del. Sig. Giovan Battista Bellaso; however, the scheme was later misattributed to Blaise de Vigenère in the 19th century, and is now widely known as the Vigenère Cipher.

Blaise de Vigenère actually invented the stronger Autokey Cipher in 1586.

First described by Giovan Battista Bellaso in 1553, the cipher is easy to understand and implement, but it resisted all attempts to break it until 1863, three centuries later. This earned it the description le chiffrage indéchiffrable (French for 'the indecipherable cipher'). Many people have tried to implement encryption schemes that are essentially Vigenère ciphers. In 1863, Friedrich Kasiski was the first to publish a general method of deciphering Vigenère ciphers. Charles Babbage had, however, already developed the same test in 1854. Gilbert Vernam worked on the vigenere cipher in the early 1900s, and his work eventually led to the one-time pad, which is a provably unbreakable cipher.

In the 19th century, the scheme was misattributed to Blaise de Vigenère (1523–1596) and so acquired its present name.

The Vigenère cipher is therefore a special case of a polyalphabetic substitution.

How it works

At its core, the Vigenère cipher is several Caesar ciphers, with a different shift value depending on the key. It can be computed simply by hand, through the use of a Vigenère table. In code, it can be done using modulo arithmetic.

Encoding

To encode, we first convert every letter to a number between 0 and 25, where A is 0, and Z is 25. If the key is shorter than the message, it is repeated until they are the same length, i.e. if the message is cryptography, and the key is secretkey:

```msg = cryptography
key = secretkeysec```

The ith character of the output O, can be computed from the message M, and key K using the follwing formula:

`O[i] = (M[i] + K[i]) mod 26`
Decoding

Decoding the output O, into the message M knowing the key K, is just as simple:

`M[i] = (O[i] - K[i]) mod 26`