blob: b8a1be45e5000ae50002e359ba9f70173a3c79c6 (
plain) (
blame)
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
|
#include <cstdio>
#include <unistd.h>
#include <cstring>
#include <pthread.h>
#include <termios.h>
#include <vector>
#include <algorithm>
#include "structs.hpp"
#define DEFAULT_PASS "default"
int encrypt(Options* options, char* data, int size);
int decrypt(Options* options, char* data, int size);
/*
* CUSTOMIZE THIS TWO METHODS
*
* Currently using basic XOR example encryption
*
*/
int encrypt(Options* options, char* data, int size)
{
if(!options->encryption)
return 0;
for(int i = 0; i < size; i++)
*(data + i) = *(data + i) ^ (int)options->password[0];
return 0;
}
int decrypt(Options* options, char* data, int size)
{
encrypt(options, data, size);
return 0;
}
|