# The Vigenere Cipher

The Vigenere cipher

In our previous article, we learned about basic substitution ciphers and its various classifications with examples.

In this article we look into the infamous Vigenere Cipher – a poly-alphabetic substitution cipher which uses multiple cipher alphabets at different positions of the message.

But first, a brief look into its history.

History

Giovan Battista Bellaso in his book La Cifra Del published in 1553 originally described the technique which was later known as Vigenere Cipher and misattributed to Blaise de Vigenère when he presented his version of Bellaso’s cipher before the court of Henry III of France in 1856.

The Vigenere Cipher gained a lot of reputation in that period as it was hailed to be ‘unbreakable’ by many. Nevertheless it was broken by many skilled cryptanalysts of the 16th century. Charles Babbage is known to have broken a variant of the cipher in 1854 although he didn’t publish that work. Friedrich Kasiski [see Wikipedia] also broke the cipher and published his work in the 19th century.

Encryption

The Vigenere Cipher can be considered as an improved variant of the Caesar Cipher (discussed in the previous article) where instead of shifting all units of the plain-text alphabet by 3, we consider multiple shift values.

The Vigenere Square or Vigenere Table (formally termed as a ‘tabula recta’) is used for encryption as it lists all the 26 possible shift values of the plain-text. (shift by 0, shift by 1, shift by 2 … shift by 25)

A repeating keyword is selected, depending on the units of which, the shift values of the units of the secret message is found. Suppose, we consider the repeating keyword as ‘TECH’, and our secret message to be encrypted is, “MY REAL NAME IS BOB”. We place the repeating keyword adjacent to each unit of the secret message and repeat it as many times it takes to cover the entire message.

```TECHTECHTECHTEC
MYREALNAMEISBOB```

Now we shift the alphabets of the message by the value of the alphabet above it in the repeating keyword modulo 26 (where modulo function returns the remainder). The alphabet values start from A=0, B=1 … up to Z=25.

```key         = TE CHTE CHTE CH TEC
message     = MY REAL NAME IS BOB
cipher text = FC TLTP PHFI KZ USD```

Shift values:
T = Shift corresponding message unit by 19.
E = Shift corresponding message unit by 4.
C = Shift corresponding message unit by 2.
H = Shift corresponding message unit by 7.

So in the given example, M when shifted by T (=19 modulo 26) gives F and Y when shifted by E (=5 modulo 26) gives C, and so on.

Decryption

The repeating keyword is the key that has to be previously agreed upon by both parties (sender and receiver). Once the receiver gets the cipher text he can easily decrypt the message by reverse substitution, i.e., once again he places the repeating keyword sequentially over the cipher text and shifts the cipher text units behind by the corresponding value of the repeating keyword unit.

So as in the given example, F when shifted backwards by T (=19 modulo 26) we get M, and C when shifted backward by E (=5 modulo 26) we get Y, and we proceed similarly to get back the original message.

Points Worth Noting
• Can be broken using the frequency analysis method.
• Since it is a poly-alphabetic cipher, it is much stronger than a mono-alphabetic cipher and is more difficult to break using frequency analysis.

To produce a 100% unbreakable cipher using this system,

• Key length = Plain-text length.
• Never use the same key twice.
• Generate a key with random alphabets.

Tool: http://www.vigenere.net/ (Even has a chrome extension)

The following two tabs change content below.

#### Mohonish Chakraborty

Mohonish ‘Xeno’ Chakraborty is a Computer Science and Engineering student from Kolkata, India. Apart from spending the entire day in front of his computer or tinkering with gadgets, he also likes to play a lot of guitar with his band, read a lot of classic fiction, and listen to a lot of heavy metal.