TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
|
Atbash Cipher implementation More...
#include <cassert>
#include <iostream>
#include <map>
#include <string>
Go to the source code of this file.
Namespaces | |
namespace | ciphers |
Algorithms for encryption and decryption. | |
namespace | atbash |
Functions for the Atbash Cipher implementation. | |
Functions | |
std::string | ciphers::atbash::atbash_cipher (const std::string &text) |
atbash cipher encryption and decryption | |
static void | test () |
Self-test implementations. | |
int | main () |
Main function. | |
Variables | |
std::map< char, char > | ciphers::atbash::atbash_cipher_map |
Atbash Cipher implementation
The Atbash cipher is a subsitution cipher where the letters of the alphabet are in reverse. For example, A is replaced with Z, B is replaced with Y, etc.
The algorithm takes a string, and looks up the corresponding reversed letter for each letter in the word and replaces it. Spaces are ignored and case is preserved.
Definition in file atbash_cipher.cpp.
std::string ciphers::atbash::atbash_cipher | ( | const std::string & | text | ) |
atbash cipher encryption and decryption
text | Plaintext to be encrypted |
Definition at line 47 of file atbash_cipher.cpp.
int main | ( | void | ) |
Main function.
Definition at line 81 of file atbash_cipher.cpp.
|
static |
Self-test implementations.
Definition at line 62 of file atbash_cipher.cpp.
std::map<char, char> ciphers::atbash::atbash_cipher_map |
Definition at line 29 of file atbash_cipher.cpp.