The Vigenere Cipher follows its name from a French cryptographer Blaise de Vigenere. This cipher is a substitution cipher that supports encryption and decryption of only alphabetic text.
There is a Vigenere’s Table which is responsible for encrypting the plaintext with the help of a key.
The table consists of 26 rows and columns with each cell storing a single letter. The storage of the letter starts from A-Z in the first row, and a left shift operation influences each successive row.
Vigenere’s Table
The ciphertext is formed by letters indexed out from the above table using the row and column names.
Let us run an example through the encryption process for the better understanding of the Vigenere Cipher.
We need a plaintext and a key before starting the encryption process.
Plaintext and Key
In order to create the ciphertext, we pick the first letter of each of the above values. 'J'
from the plaintext and 'B'
from the key. We find the table entry for which 'J'
is the row name, and 'B'
is the column name.
Creation of Ciphertext
For every letter of the plaintext, we need a letter from the key. If length of the key is small, the algorithm repeats the key until the it matches the length.
Encryption of ‘JOURNALDEV’
#data structure and algorithms #c++ #cipher #vigenere #cplusplus #programming-c