豪杰超级解霸3000[英雄版]算法分析
2007-07-24 16:45:26 来源:WEB开发网核心提示: 注册算法1.将用户名转化为DWORD值;2.将DWORD值的4个字节依次转化为字符形式,得到第一组注册码3.再进行3次变化,依次得到后面3组注册码.-VC++ 6.0 通过--void CHero3000Dlg::OnOK(){char name[512];unsigned char co
注册算法
1.将用户名转化为DWORD值;
2.将DWORD值的4个字节依次转化为字符形式,得到第一组注册码
3.再进行3次变化,依次得到后面3组注册码.
-----------------VC++ 6.0 通过------------------
void CHero3000Dlg::OnOK()
{
char name[512];
unsigned char code1[5];
unsigned char code2[5];
unsigned char code3[5];
unsigned char code4[5];
int namelen;
long reg1,reg2,reg3,reg4,temp;
int i,n;
this->UpdateData();
memset(name,0,512);
namelen = this->m_name.GetLength();
strcpy(name,this->m_name);
for(i=0;i<namelen;i++)
{
name[i] = change(i,name[i]);
}
i = (namelen / 4);
if((namelen % 4)>0) i++;
reg1 = 0;
for(n=0;n<i;n++)
{
memcpy(&temp,&name[n*4],4);
reg1 += temp;
_asm mov eax,reg1;
_asm mov ecx,n;
_asm ror eax,cl;
_asm mov reg1,eax;
}
memcpy(code1,®1,4);
for(i=0;i<4;i++)
{
code1[i] = this->regtoa(code1[i]);
}
code1[4]=0; //处理完第一组注册码
memcpy(®1,code1,4);
reg2 = reg1 * 22;
memcpy(code2,®2,4);
for(i=0;i<4;i++)
{
code2[i] = this->change(i,code2[i]);
code2[i] = this->regtoa(code2[i]);
}
code2[4] =0; //处理完第二组注册码
memcpy(®2,code2,4);
reg3 = reg2*3 + ((reg2 ^ reg1)+8)*reg1;
memcpy(code3,®3,4);
for(i=0;i<4;i++)
{
code3[i] = this->regtoa(code3[i]);
}
code3[4] =0; //处理完第三组注册码
memcpy(®3,code3,4);
reg4 = reg1*5 + ((reg2 * reg1)+6)*reg3;
memcpy(code4,®4,4);
for(i=0;i<4;i++)
{
code4[i] = this->regtoa(code4[i]);
}
code4[4] =0; //处理完第四组注册码
this->m_regcode = code1;
this->m_regcode += "-";
this->m_regcode += code2;
this->m_regcode += "-";
this->m_regcode += code3;
this->m_regcode += "-";
this->m_regcode += code4;
this->UpdateData(false);
// CDialog::OnOK();
}
char CHero3000Dlg::change(unsigned char a, char b)
{
do
{
_asm mov bl,b;
_asm test bl,0xC3;
_asm jpe st0;
_asm stc;
st0:
_asm rcr bl,1;
_asm mov b,bl;
if(a==0)
a=0xff;
else
a--;
}
while(a>0);
return b;
}
unsigned char CHero3000Dlg::regtoa(unsigned char a)
{
for(;1;)
{
a = a & 0x7f;
if(a>='A' && a<='Z' )
{
a = a 0x20; //转为小写
}
if(a == 0x6f) //如果是字符'o'则不要它。可能是'o'与'0'比较相似,在注册码中会去除。
{
a = 0x90;
a = a ^ 0x0e;
a = a 0x31;
continue ;
}
if(a == 0x30) //如果是字符'0',就不要它
{
a = 0xcf;
a = a ^ 0x0e;
a = a 0x31;
continue;
}
if(a>='a' && a<='z')
{
return a;
}
if(a>='1' && a<='9')
{
return a;
}
a = a ^ 0x0e;
a = a 0x31;
}
}
更多精彩
赞助商链接