先知道机器码为网卡的MAC地址+硬盘序号
----------------------------------------------------
网卡的MAC:08-00-27-00-C4-9B-->08002700C49B
硬盘序号:3HR1ERHC
得机器码:08002700C49B3HR1ERHC,该字串长20,浮点运算后得0xDB589480,有符号10进制数为-614951808,这就是算法!
得运算码:08002700C49B3HR1ERHC-614951808
把运算码拆分成这样:
08002700C49B3HR1ERHC-614951808
0 0 2 0 C 9 3 R E H - 1 9 1 0
8 0 7 0 4 B H 1 R C 6 4 5 8 8
变成:
0 0 2 0 C 9 3 R E H - 1 9 1 0 8 0 7 0 4 B H 1 R C 6 4 5 8 8
把空格填入k就可以了!
0k0k2k0kCk9k3kRkEkHk-k1k9k1k0k8k0k7k0k4kBkHk1kRkCk6k4k5k8k8k
DWORD sf(int snlen,int mlen)
{
int i=0,s=0;
while(snlen>i)
{
s=s+mlen+snlen;
i++;
}
i=0;
while(snlen>i)
{
__asm
{
mov eax,s
imul eax,3
mov s,eax
}
i++;
}
return s;
}
int main(int argc, char* argv[])
{
char pcid[30]={0},sn1[30]={0},sn2[30]={0},buff[10]={0};
cout<<"请输入机器码:";
cin>>pcid;
DWORD sum=strlen(pcid);
sum=sf(sum,sum*7);
itoa(sum,buff,10);
strcat(pcid,buff);
char *psn1=sn1,*psn2=sn2,*p=pcid;
for (int i=0;i<strlen(pcid);i++)
{
if (i%2==0)
{
*psn1=*p;
*psn2='k';
psn2++;
psn1++;
p++;
}
else
{
*psn1='k';
*psn2=*p;
psn2++;
psn1++;
p++;
}
}
*psn1='\0';
*psn2='\0';
printf("注册码为:%s%s\n",sn1,sn2);
return 0;
}