-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrsa.cpp
More file actions
32 lines (30 loc) · 701 Bytes
/
rsa.cpp
File metadata and controls
32 lines (30 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <vector>
#include "rsa.hpp"
#include "integer.hpp"
int main()
{
RSA rsa(128);
std::vector<integer> plain = {723};
std::vector<integer> cipher;
std::cout<<rsa;
std::cout << "plain: ";
for(int i = 0; i < plain.size(); i++)
{
std::cout << plain[i];
}
std::cout << std::endl;
std::cout << "cipher: ";
for(int i = 0; i < plain.size(); i++)
{
cipher.push_back(rsa.encrypt(plain[i]));
std::cout << cipher[i];
}
std::cout << std::endl;
std::cout << "decrypted: ";
for(int i = 0; i < cipher.size(); i++)
{
std::cout << rsa.decrypt(cipher[i]);
}
std::cout << std::endl;
}