Vigenere Cipher

OmkarWadekar
2 min readOct 15, 2020

Vigenere Cipher is a method of encrypting alphabetic text. It uses a simple form of polyalphabetic substitution. A polyalphabetic cipher is any cipher based on substitution, using multiple substitution alphabets. The encryption of the original text is done using the Vigenère square or Vigenère table.

  • The table consists of the alphabet written out 26 times in different rows, each alphabet shifted cyclically to the left compared to the previous alphabet, corresponding to the 26 possible Caesar Ciphers.
  • At different points in the encryption process, the cipher uses a different alphabet from one of the rows.
  • The alphabet used at each point depends on a repeating keyword.
Table to encrypt/decrypt

Encryption

This is a Vigenere square. The columns are all the possible keys or alphabets and the row is the letter you are trying to encrypt/decrypt.

Decryption

Decryption is performed by going to the row in the table corresponding to the key, finding the position of the ciphertext letter in this row, and then using the column’s label as the plaintext.

Example:

Let us say that this was our plaintext:

“MY NAME IS OMKAR”

We would first remove spaces.

MYNAMEISOMKAR

Then we would choose a keyword. Let us say that we chose the word GOLD.

GOLDGOLDGOLDG
MYNAMEISOMKAR

We first encrypt the letter ‘M’ with key G. This means that we find the row M on our vigenere square and find the letter in column G. This letter becomes our ciphertext letter. This also means that we encrypt the letter ‘M’ with a Caesar cipher of key ‘G’. ‘G’ corresponds to the number 6 so we are shifting the letter ‘M’ by 6. With both methods, we get the letter ‘S’.

GOLDGOLDGOLDG
MYNAMEISOMKAR
S

We now do the same thing with the plaintext letter ‘Y’ and the key letter ‘O’. Using both methods we should get the letter ‘M’.

GOLDGOLDGOLDG
MYNAMEISOMKAR
SM

D encrypted in a caesar cipher of shift L is O.

GOLDGOLDGOLDG
MYNAMEISOMKAR
SMY

We do the same thing for the rest of the message to get

SMYDSSTVUAVDX

When decrypting this we use the same method except we shift backwards. Instead of using the whole vigenere square we can take out only the section we need to get this:

ABCDEFGHIJKLMNOPQRSTUVWXYZ
GHIJKLMNOPQRSTUVWXYZABCDEF
OPQRSTUVWXYZABCDEFGHIJKLMN
LMNOPQRSTUVWXYZABCDEFGHIJK
DEFGHIJKLMNOPQRSTUVWXYZABC

For this table, the row is the key and the column is the plaintext but it does not really matter.

Try decrypting this message. The key is BREAK.

WZHYKMRRKKSZRSDJKYTOPWXEMIESLYHP

VIDYALANKARINSTITUTEOFTECHNOLOGY

--

--

OmkarWadekar
0 Followers

2022 , Vidyalankar Institute of Technology , Wadala, Mumbai