之前友坛上别人发的。
[C++] 纯文本查看 复制代码 #include <iostream>
#include <Windows.h>
#include <time.h>
#include <cstring>
using namespace std;
int main()
{
char st[21] = { 0 }; //用户名
char jqm_a[31] = { 0 }; //机器码
char jqm[21] = { 0 }; //机器码前20位
cout << "请输入你的用户名:";
cin >> st;
cout << "请输入你的机器码:";
cin >> jqm_a;
int q;
memcpy(jqm, jqm_a, 20);
cout << "取机器码的前20位来算序列号" << jqm << endl;
q = jqm[2];
jqm[2] = jqm[18];
jqm[18] = q;
q = jqm[4];
jqm[4] = jqm[15];
jqm[15] = q;
q = jqm[8];
jqm[8] = jqm[11];
jqm[11] = q;
while (1)
{
char mb[7] = { 0 }; //运算的出的字符串
int eax_3;
int edi_3 = 0;
for (int i = 0; i < 20; i++)
{
eax_3 = st[i] ^ jqm[i];
eax_3 = eax_3 * i;
eax_3 = eax_3 + edi_3;
edi_3 = eax_3;
}
edi_3 = edi_3 + 0x3039;
itoa(edi_3, mb, 10); //mb=得到那5个秘钥字符,
char str_z[51]; //存放真正的字符串
char str[51]; //序列号
char str1[6] = { 0 }; //序列号后5个字符
int esi = 0;
int eax = 0;
int ecx = 0;
int edi;
int arg_3 = 0x2D; //序列号长度-5
BYTE dl;
const char* str2 = "1234567890";
int edi_33 = edi_3;
srand((unsigned int)time(0));
while (1)
{
for (int i = 0; i < 5; i++) //生成序列号前10个字符
itoa((mb[i] + 0x14 - 9 - (1 / 2 + i)), str_z + (i * 2), 10);
for (int i = 0; i <= 9; i++)
str[i] = str_z[i];
int eax_4;
int ecx_4;
int edx_4;
edi_3 = edi_33;
edi_3 = edi_3 + 0x4d44;
eax_4 = int(edi_3 * 3.14 * 0.1594896331738427110);
edi_3 = eax_4;
ecx_4 = 0x186a0;
edx_4 = eax_4 % ecx_4;
itoa((edx_4 % 10 + 0x41) - 9 - 11 / 2 + 9, str + 10, 10);
for (int i = 12; i < 50; i++)
str[i] = str2[rand() % 10];
int g; //交换
g = str[2];
str[2] = str[38];
str[38] = g;
g = str[4];
str[4] = str[25];
str[25] = g;
g = str[9];
str[9] = str[31];
str[31] = g;
for (int i = 0; i <= 4; i++)
str1[i] = str[45 + i];
esi = 0;
eax = 0;
ecx = 0;
while (1)
{
if (ecx == 0xB26D)
{
edi = 0;
while (edi < arg_3)
{
ecx++;
dl = 0x80;
do {
BYTE ah;
ah = WORD(eax) / 256;
if (ah >= 0x80)
{
eax = eax + eax;
WORD x = (WORD(eax) ^ 0x1021);
eax = eax / 65536;
eax = eax * 65536;
eax = eax + x;
ecx++;
}
else
eax = eax + eax;
ecx++;
if (str[esi] & dl)
{
WORD x = (WORD(eax) ^ 0x1021);
eax = eax / 65536;
eax = eax * 65536;
eax = x + eax;
}
dl = dl / 2;
} while (dl != 0);
esi++;
edi++;
}
}
ecx++;
if (ecx >= 0x186A0)
break;
}
if (WORD(eax) == atof(str1))
break;
}
int g; //生成第11,12个字符
char str_1[41] = { 0 };
for (int i = 0; i <= 40; i++)
str_1[i] = str[i];
g = str_1[2];
str_1[2] = str_1[38];
str_1[38] = g;
g = str_1[4];
str_1[4] = str_1[25];
str_1[25] = g;
g = str_1[9];
str_1[9] = str_1[31];
str_1[31] = g;
char str_2[21] = { 0 }; //产生的那20个字符
char str_3[3] = { 0 };
int zj = 0;
int edx_1 = 0;
int ebx_1 = 0;
int eax_1 = 0;
for (int i = 0; i < 40; i = i + 2)
{
ebx_1++;
str_3[0] = str_1[i];
str_3[1] = str_1[i + 1];
eax_1 = atof(str_3);
edx_1 = ebx_1;
edx_1 = edx_1 / 2;
eax_1 = eax_1 + edx_1;
eax_1 = eax_1 + 9;
str_2[i / 2] = eax_1;
ebx_1++;
}
int zjz = 0;
for (int i = 0; i < 19; i++)
zjz = zjz + str_2[i];
zjz = zjz % 10;
zjz = zjz + 0x30;
if (str_2[19] == zjz || str_2[19] >= 0x41)
{
cout << "序列号为:";
for (int i = 0; i <= 49; i++)
cout << str[i];
cout << endl;
break;
}
}
return 0;
}
|