-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
45 lines (35 loc) · 867 Bytes
/
test.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
//
// Created by Taiga on 2023/3/8.
//
#include "app/student_mange_server.h"
#include "nlohmann/json.hpp"
#include "app/token.h"
#include "util/logger.h"
#include "util/base64.h"
#include "util/md5.h"
using namespace std;
using namespace calabash;
using namespace nlohmann;
string XOR(const string &val, const string &key) {
size_t i = 0;
string ret;
for (char th : val) {
ret.push_back(static_cast<char>(th ^ key[i]));
i = (i + 1) % key.size();
}
return ret;
}
string Encode(const string &val, const string &key) {
return Base64::Encode(XOR(val, key));
}
string Decode(const string &val, const string &key) {
return XOR(Base64::Decode(val), key);
}
int main() {
// auto server = StudentMangeServer::Instance();
// server->Init(8080, "test.db");
// string str = MD5().Encode("wang123456");
//
// cout << str << endl;
return 0;
}