-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
42 lines (30 loc) · 1.13 KB
/
main.cpp
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
33
34
35
36
37
38
39
40
41
#include "ElGamal/elgamal.h"
int main() {
char prompt;
std::cout << "Welcome to the ElGamal Encryption algorithm! Encrypt or Decrypt your messages" << std::endl;
do {
std::cout << "Enter 'E' to encrypt or 'D' to decrypt (press any key to quit): ";
std::cin >> prompt;
std::cin.ignore();
if (prompt == 'E') {
//read message
std::string message;
std::cout << "Enter the message you would like to encrypt: ";
std::getline(std::cin, message);
//convert message
bigint message_int = textToInt(message);
//encrypt message
encryption(message_int);
// prompt = 'h';
} else if (prompt == 'D') {
std::string gamma, delta;
std::cout << "Enter γ: ";
std::cin >> gamma;
std::cout << "Enter δ: ";
std::cin >> delta;
std::string message = decryption(gamma, delta);
std::cout << "Message Decrypted: " << intToText(message) << std::endl;
}
} while (prompt == 'E' || prompt == 'D');
return 0;
}