-
Notifications
You must be signed in to change notification settings - Fork 0
/
vigenere.cpp
executable file
·49 lines (46 loc) · 1.32 KB
/
vigenere.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
42
43
44
45
46
47
48
49
#include <iostream>
#include "vigenere.h"
#include <stdio.h>
int main(){
setlocale(LC_ALL, "spanish");
string key, message;
string words = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//words.push_back((char) 165);
//words << "OPQRSTUVWXYZ";
Vigenere test(words);
//-------------------------------------------
int opt = 0;
cout << "Bienvenidos a la encriptacion de Vigenere" << endl;
do{
key = "\0"; message = "\0";
cout << "Elija una opcion del menu: " << endl;
cout << "1) Cifrar" << endl;
cout << "2) Descifrar" << endl;
cout << "3) Salir" << endl;
cin >> opt;cin.ignore(256, '\n');// para limpiar el buffer
switch (opt){
case (1):
cout << "Key: ";
cin >> key;
cout << "Message: ";
getchar();
getline(cin,message,'\n');
cout<< " Encrypt message: " << test.encrypt(message, key) << endl;
break;
case (2):
cout << "Key: ";
cin >> key;
cout << "Message: ";
getchar();
getline(cin,message,'\n');
cout<< "Decipher message: " << test.decipher(message, key) << endl;
break;
case (3):
break;
default:
cout << "opcion incorrecta, vuelva a elegir" << endl;
break;
}
}while( opt != 3);
return 0;
}