-
-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathcl.cpp
31 lines (25 loc) · 734 Bytes
/
cl.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
#include <stdio.h>
#include <string.h>
#include <string>
#include <iostream>
#include <stdio.h>
#include <ctype.h>
#include "encrypt.h"
using namespace std;
int main(int argc, char** argv) {
if(argc != 4) {
std::cout << "Usage: ./a.out message key (0:encrypt|1:decrypt)" << std::endl;
std::cout << "./a.out \"Hello world\" MYPRIVATEKEY 0" << std::endl;
std::cout << "./a.out ttz9JqxZHBClNtu= MYPRIVATEKEY 1" << std::endl;
return -1;
}
std::string msg = argv[1];
std::string key = argv[2];
int encrypt_flag = atoi(argv[3]);
if(encrypt_flag == 0) {
std::cout << encrypt(msg, key) << std::endl;
} else {
std::cout << decrypt(msg, key) << std::endl;
}
return 0;
}