其实可以直接最后在内存中查看序列号,但是为了锻炼自己还是写了一下注册机。
#include<iostream>
using namespace std;
int main()
{
int ch1[] = { 0xaa,0x89,0xc4,0xfe,0x46};
int ch2[] = { 0x78,0xf0,0xd0,0x03,0xe7};
int ch3[] = { 0xf7,0xfd,0xf4,0xe7,0xb9};
int ch4[] = { 0xb5,0x1b,0xc9,0x50,0x73};
int ch5[] = { 0,0,0,0 };
int flag[100] = { 0 };
string username;
cout << "输入用户名:";
cin >> username;
int length = username.length();
for (int i = 0; i < length; i++)
{
flag[i] = int(username[i]);
}
for (int i = 1, j = -1; i <= length; i++)
{ j++;
if (j >= 5)
j = 0;
int mid = flag[i];
int sum = flag[i] ^ ch1[j];
flag[i] = sum;
ch1[j] = mid;
}
for (int i = length , j = -1; i > 0; i--)
{
j++;
if (j >= 5)
j = 0;
int mid = flag[i];
flag[i] ^= ch2[j];
ch2[j] = mid;
}
for (int i = 1, j = -1; i <= length; i++)
{
j++;
if (j >= 5)
j = 0;
int mid = flag[i];
flag[i] ^= ch3[j];
ch3[j] = mid;
}
for (int i = length , j = -1; i > 0; i--)
{
j++;
if (j >= 5)
j = 0;
int mid = flag[i];
flag[i] ^= ch4[j];
ch4[j] = mid;
}
for (int i = 1, j = -1; i <= length; i++)
{
j++;
if (j >= 4)
j = 0;
ch5[j] = (ch5[j] + flag[i]) % 0x100;
}
long long eax = (double)ch5[0] + (double)ch5[1]*0x100 + (double)ch5[2]*0x10000 + (double)ch5[3]*0x1000000;
int i = 0;
while (eax)
{
flag[i] = (eax % 0x0a) + 0x30;
eax = eax / 0x0a;
i++;
}
for (int u = i - 1; u >= 0; u--)
cout << char(flag[u]);
return 0;
}
运行结果:
输入:123456
输出:894904543
|