Implementation of Vigenère cipher algorithm.
The Vigenère cipher is a method of encrypting alphabetic text by using a series of interwoven vigenere ciphers, based on the letters of a keyword. It employs a form of polyalphabetic substitution.
AlgorithmThe encryption can also be represented using modular arithmetic by first transforming the letters into numbers, according to the scheme, A → 0, B → 1, ..., Z → 25. Encryption of \(i^{th}\) character in Message M by key K can be described mathematically as,
\[ E_{K}(M_{i}) = (M_{i} + K_{i})\;\mbox{mod}\; 26\]
while decryption of \(i^{th}\) character in Cipher C by key K can be described mathematically as,
\[ D_{k}(C_{i}) = (C_{i} - K_{i} + 26)\;\mbox{mod}\; 26\]
Where \(K_{i}\) denotes corresponding character in key. If \(|key| < |text|\) than same key is repeated untill their lengths are equal.
For Example, If M = "ATTACKATDAWN" and K = "LEMON" than K becomes "LEMONLEMONLE".
Definition in file vigenere_cipher.cpp.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4