Hello
There is a problem with the line " fract=((int)fract^counter);"Code:void KeyGen (char* UserName) { int length; char * b_name; int divider=10; int counter; char tmp; int tmp_int; float tot; double fract; double integer; int Serial[10]; char p_hex[0]; char * Serial_out; int i_integer; char tot_hex='0'; char *FullSerial; if(strlen(UserName)>11) { b_name=new char[strlen(UserName)]; strxfrm(b_name,UserName,10); } else { b_name=new char[strlen(UserName)]; strcpy(b_name,UserName); } length=strlen(b_name); cout << endl; for(counter=0;counter<length;counter++) { tmp=b_name[counter]; tmp_int=(int)tmp; itoa(tmp_int,p_hex,16); tot=(float)tmp_int/10; fract=modf(tot,&integer); fract=fract*10; fract=((int)fract^counter);<-------------- cout << fract << endl; fract=fract+2; if(fract>=10) { fract=fract-10; } itoa((int)fract,p_hex,16); Serial[counter]=(int)fract; } cout << "Serial Number : " <<endl; for(int i=9;i>=0;i--) { cout << "0" <<Serial[i]<<endl; } delete b_name; }
it doesn't always do the right thing...If i type Liquid][Shadow as UserName into the function above i'll get the following as Serial :
02030807070307030607
and this if i do it using Caclulator :
05030807070306030608
so for instance with letter "L",counter=0,fract=6 so
fract=((int)fract^counter) would mean 6 xor 0 ,which is 6,
but instead of 6 i get 5...why is this??
if i pass the letter "l" into it,counter=0,fract=8 so
fract=((int)fract^counter) would mean 8 xor 0,which is 8
and this time my function does output 8
i checked the output using cout << fract;
can someone help me please thnx s
Please use [code][/code]Tags



LinkBack URL
About LinkBacks


