Bifid cipher: Difference between revisions
m
Small improvement to code.
m (Correct minor error.) |
m (Small improvement to code.) |
||
Line 211:
#include <iostream>
#include <stdexcept>
#include <
#include <unordered_map>
#include <vector>
Line 219:
class Bifid {
public:
Bifid(const int32_t n,
if ( text.length() != n * n ) {
throw new std::invalid_argument("Incorrect length of text");
Line 246:
}
std::string encrypt(
std::vector<int32_t> row_one, row_two;
for ( const char& ch : text ) {
Line 262:
}
std::string decrypt(
std::vector<int32_t> row;
for ( const char& ch : text ) {
Line 281:
void display() const {
for ( const std::vector<char>& row : grid ) {
for ( const char& ch : row ) {
std::cout << ch << " ";
Line 293:
};
void runTest(Bifid& bifid, std::
std::cout << "Using Polybius square:" << std::endl;
bifid.display();
Line 305:
int main() {
const std::
const std::
const std::
Bifid bifid1(5, "ABCDEFGHIKLMNOPQRSTUVWXYZ");
|