std::map<char, char> atbash_cipher_map = {
30{
'a',
'z'}, {
'b',
'y'}, {
'c',
'x'}, {
'd',
'w'}, {
'e',
'v'}, {
'f',
'u'},
31{
'g',
't'}, {
'h',
's'}, {
'i',
'r'}, {
'j',
'q'}, {
'k',
'p'}, {
'l',
'o'},
32{
'm',
'n'}, {
'n',
'm'}, {
'o',
'l'}, {
'p',
'k'}, {
'q',
'j'}, {
'r',
'i'},
33{
's',
'h'}, {
't',
'g'}, {
'u',
'f'}, {
'v',
'e'}, {
'w',
'd'}, {
'x',
'c'},
34{
'y',
'b'}, {
'z',
'a'}, {
'A',
'Z'}, {
'B',
'Y'}, {
'C',
'X'}, {
'D',
'W'},
35{
'E',
'V'}, {
'F',
'U'}, {
'G',
'T'}, {
'H',
'S'}, {
'I',
'R'}, {
'J',
'Q'},
36{
'K',
'P'}, {
'L',
'O'}, {
'M',
'N'}, {
'N',
'M'}, {
'O',
'L'}, {
'P',
'K'},
37{
'Q',
'J'}, {
'R',
'I'}, {
'S',
'H'}, {
'T',
'G'}, {
'U',
'F'}, {
'V',
'E'},
38{
'W',
'D'}, {
'X',
'C'}, {
'Y',
'B'}, {
'Z',
'A'}, {
' ',
' '}
49 for(
charletter : text) {
50result += atbash_cipher_map[letter];
64std::string text =
"Hello World";
65std::string expected =
"Svool Dliow";
68assert(expected == encrypted_text);
69assert(text == decrypted_text);
70std::cout <<
"Original text: "<< text << std::endl;
71std::cout <<
", Expected text: "<< expected << std::endl;
72std::cout <<
", Encrypted text: "<< encrypted_text << std::endl;
73std::cout <<
", Decrypted text: "<< decrypted_text << std::endl;
74std::cout <<
"\nAll tests have successfully passed!\n";
std::string atbash_cipher(const std::string &text)
atbash cipher encryption and decryption
static void test()
Self-test implementations.
int main()
Main function.
Functions for the Atbash Cipher implementation.
Algorithms for encryption and decryption.
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