-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.cpp
97 lines (81 loc) · 1.8 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "decompiled.hpp"
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
void ACFXGetSecertByName(const char *name, _BYTE *secert)
{
int nameLen = strlen(name);
_BYTE vResult[5];
// vResult[0] = secert[0] = 0; // rand();
// vResult[1] = secert[1] = 0; // rand();
// vResult[2] = secert[4] = 0; // rand();
// vResult[3] = secert[6] = 0; // rand();
// vResult[4] = secert[7] = 0; // rand();
memset(vResult, 0, sizeof(vResult));
memset(secert, 0, sizeof(vResult));
for (int i = 0; i < 5; i++)
{
char v16 = ACDXSecretCode1[i];
for (int j = 0; j < nameLen; j++)
{
v16 += name[j] | (17 * i + vResult[(i + j) % 5]);
}
secert[ACDXSecretCode2[i]] = v16;
}
return;
}
void ACFXGetCodeBySecert(const _BYTE *secert, char *code)
{
_BYTE xcode[16];
_BYTE s[11];
memcpy(s, secert, sizeof s);
for (size_t i = 0; i < 16; i++)
{
int bb = i * 5;
int c = bb / 8;
int cr = bb % 8;
xcode[i] = ((s[c] >> cr) | (s[c + 1] << (8 - cr))) & 0b11111;
}
for (size_t i = 0; i < 16; i++)
{
code[i] = ACDXSecertCode0[xcode[i]];
}
return;
}
int main()
{
int mode;
cout << "Enter mode(0=gen, otherwise=debug):" << endl;
cin >> mode;
if (mode)
{
string name, code;
_BYTE secert1[10];
_BYTE secert2[10];
while (cin >> name >> code)
{
ACFXGenCodeSecert(code.c_str(), secert1);
ACFXGenCodeSecertBeautify(code.c_str(), secert2);
cout << (ACFXMatchSecertBeautify(name.c_str(), secert1) ? "Matched" : "Failed") << endl;
}
}
else
{
string name;
while (cin >> name)
{
for (size_t i = 0; i < name.length(); i++)
name[i] = toupper(name[i]);
_BYTE secert[10];
ACFXGetSecertByName(name.c_str(), secert);
char code[17];
code[16] = 0;
ACFXGetCodeBySecert(secert, code);
cout << code << endl;
}
}
getchar();
return 0;
}