# Vigenere Cipher in Cryptography

Submitted by Monika Sharma, on January 17, 2020

The Vigenere cipher is one of the well-known techniques used for encrypting the data, which was proposed by Friedrich Kasiski in 1863. Although the Caeser cipher, which was amongst the firstly developed encryption techniques which gave us the idea of developing the entire encryption and decryption process, was not widely used due to its simplicity and being more prone to be cracked by any outsider. To overcome this, the algorithm of vigenere cipher was developed which was formed by a series of inter-woven caesar ciphers.

Now, talking about its characteristics and details, Vigenere cipher, unlike the Caeser cipher, is a polyalphabetic cipher, which means that if a letter 'm' is replaced by a letter 'c' at a place, it can be replaced by some other letter say 'd' at some other place. This cipher is also a type of shift cipher because in this technique we just shift the letters of the plain text to a certain number, (which is determined by the corresponding character of the key string) in a lexicographic order to obtain the ciphertext. The same process is applied in reverse by subtracting the number. The respective letters are thus shifted in reverse lexicographic order are shifted back in the decryption process to obtain the plain text back.

The following key points can be drawn for the Vigenere cipher,

• The key chosen here is a string whose length must be either less or equal to the length of the plain text.
• It is a type of symmetric-key cryptography.
• It is a type of poly-alphabetic cipher, being a part of the substitution cipher.

### Encryption Process

• Here, we assume the numbers 0-25 represent the English alphabets in lexicographic order, i.e. from a to z, and the letters of the Key string are also considered in the same manner.
• The letters of the key string are repeated again and again until its length becomes equal to that of the plain text.
• Tape the elements of the plain text with the respective elements of the ley string which hold the same positions.
• Therefore, the encryption on the plain text to convert it into ciphertext is performed as follows,
```    E (Pi , Ki) = (Pi + Ki) mod 26
```

### Decryption Process

Here also, the numbers 0-25 represent the English alphabets in lexicographic order, i.e. from a to z, and we choose the same key string 'K' that we used to encrypt our data. Suppose we denote the numbers representing the letters of the ciphertext using 'C'.

The decryption of the ciphertext to convert it back into plain text is performed as follows,

```    D (Ci , Ki) = ( Ci – Ki ) mod 26
```

### Example Problem

```    Given Plain text: 'GIVE MONEY'
Key: LOCK
```

Convert the given plain text into cipher text...

Solution:

• Repeat the key sting until its length becomes equal to that of the plain text,
```G  I  V  E  M O N E  Y
L  O  C  K  L  O C  K  L
```
• Tape the elements of the plain text with the respective elements of the ley string which hold the same positions.
Example for position 1, we encrypt as follows,
```E( G, L )   = ( G + L ) mod 26
= ( 11 + 6 ) mod 26
= 17 mod 26
= R
```

Similarly, after performing the encryption for the whole plain text, the cipher text that we get for the word 'GIVEMONEY' is 'RWXOXCPOJ'.

Note: You can cross-check your answer by applying the decryption process over the ciphertext, and if it comes back to be the same as the plain text, then it means that our answer is correct.