mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-24 13:53:35 +08:00
[feat/fix]: uses uint8_t for maps instead of int
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
#include <sstream> /// for std::stringstream
|
#include <sstream> /// for std::stringstream
|
||||||
#include <string> /// for std::string
|
#include <string> /// for std::string
|
||||||
#include <vector> /// for std::vector
|
#include <vector> /// for std::vector
|
||||||
|
#include <cstdint> /// for uint8_t
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @namespace ciphers
|
* @namespace ciphers
|
||||||
@@ -29,14 +30,14 @@ namespace ciphers {
|
|||||||
*/
|
*/
|
||||||
namespace a1z26 {
|
namespace a1z26 {
|
||||||
|
|
||||||
std::map<int, char> a1z26_decrypt_map = {
|
std::map<uint8_t, char> a1z26_decrypt_map = {
|
||||||
{1, 'a'}, {2, 'b'}, {3, 'c'}, {4, 'd'}, {5, 'e'}, {6, 'f'}, {7, 'g'},
|
{1, 'a'}, {2, 'b'}, {3, 'c'}, {4, 'd'}, {5, 'e'}, {6, 'f'}, {7, 'g'},
|
||||||
{8, 'h'}, {9, 'i'}, {10, 'j'}, {11, 'k'}, {12, 'l'}, {13, 'm'}, {14, 'n'},
|
{8, 'h'}, {9, 'i'}, {10, 'j'}, {11, 'k'}, {12, 'l'}, {13, 'm'}, {14, 'n'},
|
||||||
{15, 'o'}, {16, 'p'}, {17, 'q'}, {18, 'r'}, {19, 's'}, {20, 't'}, {21, 'u'},
|
{15, 'o'}, {16, 'p'}, {17, 'q'}, {18, 'r'}, {19, 's'}, {20, 't'}, {21, 'u'},
|
||||||
{22, 'v'}, {23, 'w'}, {24, 'x'}, {25, 'y'}, {26, 'z'},
|
{22, 'v'}, {23, 'w'}, {24, 'x'}, {25, 'y'}, {26, 'z'},
|
||||||
};
|
};
|
||||||
|
|
||||||
std::map<char, int> a1z26_encrypt_map = {
|
std::map<char, uint8_t> a1z26_encrypt_map = {
|
||||||
{'a', 1}, {'b', 2}, {'c', 3}, {'d', 4}, {'e', 5}, {'f', 6}, {'g', 7},
|
{'a', 1}, {'b', 2}, {'c', 3}, {'d', 4}, {'e', 5}, {'f', 6}, {'g', 7},
|
||||||
{'h', 8}, {'i', 9}, {'j', 10}, {'k', 11}, {'l', 12}, {'m', 13}, {'n', 14},
|
{'h', 8}, {'i', 9}, {'j', 10}, {'k', 11}, {'l', 12}, {'m', 13}, {'n', 14},
|
||||||
{'o', 15}, {'p', 16}, {'q', 17}, {'r', 18}, {'s', 19}, {'t', 20}, {'u', 21},
|
{'o', 15}, {'p', 16}, {'q', 17}, {'r', 18}, {'s', 19}, {'t', 20}, {'u', 21},
|
||||||
|
|||||||
Reference in New Issue
Block a user