-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
33 lines (30 loc) · 804 Bytes
/
index.js
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
const readline = require('readline');
const stdio = readline.createInterface({
input: process.stdin,
output: process.stdout
});
const GENERATOR = 'A';
const ENCRYPT = 'B';
const DECRYPT = 'C';
console.log('A: generator rsa key');
console.log('B: encrypt');
console.log('C: decrypt');
stdio.question(
'Choose a option...\n',
(ans) => {
switch (ans) {
case GENERATOR:
require('./RSA/generator')(stdio);
break;
case ENCRYPT:
require('./RSA/encrypt')(stdio);
break;
case DECRYPT:
require('./RSA/decrypt')(stdio);
break;
default:
console.log('Can not find the option.');
process.exit(1);
}
}
);