Vigenere cipher is a basic poly-alphabetic substitution cipher and it is implemented here using C++.
Vigenere cipher is one of the basic forms of poly-alphabetic that uses a word as a key to substitute plain-text letters for encryption. Here each alphabet in key acts as a number to increment the plaintext in order to encode it.
In case the key is shorter than the plaintext, then the key is repeated continuously for the length of the whole plain-text.
It’s encryption can be represented as : E = (Pi + Ki) mod 26
For example :
Plain Text : P A S S W O R D 15 0 18 18 22 14 17 3 Key : K E Y K E Y K E 10 4 24 10 4 24 10 4
(15+10)mod26 = 25 -> Z
(0+4)mod26 = 4 -> E
(18+24)mod26 = 25 -> Q
(18+10)mod26 = 2 -> C
(22+4)mod26 = 0 -> A
(14+24)mod26 = 12 -> M
(17+10)mod26 = 1 -> B
(3+4)mod26 = 7 -> H
Cipher Text: Z E Q C A M B H
Submitted by Anshuman Prakash (devsecansh)
Download packets of source code on Coders Packet