-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvigenere.cpp
More file actions
49 lines (31 loc) · 1.21 KB
/
vigenere.cpp
File metadata and controls
49 lines (31 loc) · 1.21 KB
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
#include "cryptoObj.h"
#include "VIGENEREimplement.h"
vigenere::vigenere() { // Constructor
std::cout << "vigenere constructor " << std::endl;
}
vigenere::~vigenere() { // destructor
std::cout << "vigenere destructor " << std::endl;
}
void vigenere::execute(std::string str, std::string word) {
if (str.compare(0,7,"enckey-") == 0) { // enckey-key
std::string key = str.substr(7);
std::cout << "vigenere enc executed with key " << key << std::endl;
std::string keyV = generateKey("word", key);
std::string cipher_text = cipherText("word", keyV);
std::cout << "vigenere enc val is " << cipher_text << std::endl;
}
else if (str.compare(0, 7, "deckey-") == 0) { // deckey-key
std::string key = str.substr(7);
std::cout << "vigenere dec executed with key " << key << std::endl;
std::string keyV = generateKey(word, key);
std::string plain_text = originalText(word, keyV);
std::cout << "vigenere dec val is " << plain_text << std::endl;
}
else if (str.compare("crack") == 0) { // crack
std::cout << "vigenere crack val is " << probe(word) << std::endl;
}
}
void vigenere::breakChances() {
encryption::breakChances();
std::cout << "this is vigenere breakChances." << std::endl;
};