keyfile的文章俺已经收到,多谢大哥们,昨天,可能贴漏的注册算法. (2千字)
下面是俺写的注册算法的C程序(在TC20下测试过)说明:下面的算法,在输入注册信息时,最好别输入特别的情况,如:space...
俺没有作过多的这种验证,只在连续的字符情况下试过.
#include <ctype.h>
#include <stdio.h>
#include <string.h>
int flag1 = 0;
int flag2 = 0;
long int op1 ,op2;
int computereg(unsigned char *string);
void main( void )
{
unsigned char name[60];/*= "fengy";*/
unsigned char organization[60];/*= "home";*/
unsigned char address1[60];/*= "beijing1";*/
unsigned char address2[60];/*= "beijing2";*/
unsigned char city[60];/* = "beijing3";*/
long int regcode;
flag2 = 0;
flag1 = 0;
op1 = 0x12345678;
op2 = 0x87654321;
printf("Please input your name:");
gets(name);
printf("Please input your organization :");
gets(organization);
printf("Please input your address1:");
gets(address1);
printf("Please input your address2:");
gets(address2);
printf("Please input your city:");
gets(city);
printf(" name : %s \n org : %s \n add1 : %s \n add2 : %s \n city : %s \n", name , organization , address1 , address2 , city );
computereg(name);
computereg(organization);
computereg(address1);
computereg(address2);
computereg(city);
regcode = op1+0xc7 + op2*0xc8;
printf("regcode : %lx \n",regcode);
printf("\t------Fengy--------\n");
getch();
}
int computereg(unsigned char *string)
{
int slen;
int i,j;
long int op;
slen = strlen(string);
for(i = 0 ; i< slen ; i++)
{
if(string[i]<0x41) return 0;
if (islower(string[i]) != 0 )
{
string[i]= toupper(string[i]);
}
op1 = (long int)((string[i]*5+1)& 0xff) + op1;
if(((op1&0xff000000)&0x80000000) != 0)
{
flag1 = 1;
}
else
{
flag1 = 0;
}
if (flag1 == 0) /* zf = 1 [ebp-05]= 0*/
{
op1= op1+op1;
}
else /* zf = 0 ,setne [ebp-05] = 1*/
{
op1 = (op1+op1)|0x00000001;
}
op2 = (long int)((string[i]*5+1)&0xff) + op2;
for(j = (0x20-1) ; j>0 ; j--)
{
if(((op2&0xff000000)&0x80000000) != 0)
{
flag2 = 1;
}
else
{
flag2 = 0;
}
if (flag2 == 0) /* zf = 1 [ebp-05]= 0*/
{
op2= op2+op2;
}
else /* zf = 0 ,setne [ebp-05] = 1*/
{
op2 = (op2+op2)|0x00000001;
}
}
}
return 0;
}
---- Fengy ----
