-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.cpp
57 lines (50 loc) · 1.65 KB
/
main.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
50
51
52
53
54
55
56
57
// Libs
#include<Windows.h>
#include<iostream>
#include<string>
using namespace std;
string text;
// Colors
void setcolor(unsigned short color)
{
HANDLE hcon = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleTextAttribute(hcon, color);
}
// Encryption & Decription Function
string XOR(string data, char key[])
{
string xorstring = data; // Initialize a variable for our XOR data
for (int i = 0; i < xorstring.size(); i++) { // This is for scrambling things in the string
xorstring[i] = data[i] ^ key[i % (sizeof(key) / sizeof(char))]; // Scrambling the string or descambling it
}
return xorstring;
}
// Xor Function
int main(){
system("cls");
SetConsoleTitle(["Gasai] | By Kenyh");
setcolor(2);
cout<<" _____ _____ _____ _____ _____ "<<endl;
cout<<" | __| _ | __| _ | |"<<endl;
cout<<" | | | |__ | |- -|"<<endl;
cout<<" |_____|__|__|_____|__|__|_____| \n \n \n"<<endl;
cout<<"[";
setcolor(15);
cout<<"+";
setcolor(2);
cout<<"] What string do you want to encrypt?: ";
setcolor(15);
cin>>text;
cout<<"\n";
char key[5 /*Number of charactes */] = { 'K', 'E', 'N', 'Y', 'H'}; // Encryption key, you can change it but you also need to modify the number of characters
string data = XOR(text, key);
setcolor(2);
cout<<"[";
setcolor(15);
cout<<"+";
setcolor(2);
cout<<"] ";
cout<<data<<endl;
system("pause>nul");
main();
}