-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_encryption_encode.cpp
More file actions
76 lines (54 loc) · 1.34 KB
/
main_encryption_encode.cpp
File metadata and controls
76 lines (54 loc) · 1.34 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "encryption.h"
#include "base64.h"
#include <iostream>
using namespace std;
int main()
{
/*
// all xor encryptino test
int const SIZE = 16;
vector<char>* buffer = new vector<char>{ 'H', 'e', 'l', 'l', 'e', ' ', 'W', 'o', 'r', 'l', 'd', '!', '!', '!'};
string key = "Hello World!!!";
string key2 = "World!!! Hello";
encryption(buffer, key);
//key one should be all ' '
cout << "encryption 1: " << endl;
for (int x = 0; x < buffer->size(); x++)
{
cout << (*buffer)[x];
}
cout << endl << endl;;
encryption(buffer, key);
//key one should be key
cout << "encryption 2: " << endl;
for (int x = 0; x < buffer->size(); x++)
{
cout << (*buffer)[x];
}
cout << endl << endl;
*/
//Hel == SGVs
vector<char>* buffer = new vector<char>();
vector<char>* buffer2 = new vector<char>();
string key = "Hello World!!!";
std::string value = "*&**&&*(*(*(*&(*(*(*(*(**&";
for (int x = 0; x < value.length(); x++)
{
buffer->push_back(value[x]);
}
encryption(buffer, key);
buffer = encode64(buffer);
for (int x = 0; x < buffer->size(); x++)
{
cout << (*buffer)[x];
}
cout << endl;
buffer2 = decode64(buffer);
encryption(buffer2, key);
cout << buffer2->size() << endl;
for (int x = 0; x < buffer2->size(); x++)
{
cout << (*buffer2)[x];
}
cout << endl;
}