47 std::string hashtext =
"";
49 for (int64_t i = 0; uint64_t(i) < plaintext.length(); i++) {
51 if (isupper(plaintext[i])) {
53 hashtext += char(int64_t(plaintext[i] + key - 65) % 26 + 65);
56 hashtext += char(int64_t(plaintext[i] + key - 97) % 26 + 97);
64 std::string encoded =
"";
70 for (int64_t i = 0; uint64_t(i) < key.size(); i++) {
71 if (key[i] >=
'A' && key[i] <=
'Z') {
76 if (arr[key[i] - 65] == 0) {
80 }
else if (key[i] >=
'a' && key[i] <=
'z') {
81 if (arr[key[i] - 97] == 0) {
82 encoded += key[i] - 32;
90 for (int64_t i = 0; i < 26; i++) {
93 encoded += char(i + 65);
100 std::string encoded_text) {
101 std::string cipher =
"";
107 for (int64_t i = 0; uint64_t(i) < plaintext.size(); i++) {
108 if (plaintext[i] >=
'a' && plaintext[i] <=
'z') {
109 int64_t pos = plaintext[i] - 97;
110 cipher += encoded_text[pos];
113 else if (plaintext[i] >=
'A' && plaintext[i] <=
'Z') {
114 int64_t pos = plaintext[i] - 65;
115 cipher += encoded_text[pos];
119 cipher += plaintext[i];
std::string keyword_encode(std::string key)
std::string keyword(std::string plaintext, std::string encoded_text)
std::string caesar(std::string plaintext, int64_t key)