philpem
December 31st, 2003, 16:12
Hi,
I'm currently trying to write my first "real" keygen. The algorithm - FWICT - takes the username, produces an intermediate code (i-code). Next, it generates another i-code based on the key (a 4-character Base 18 code) and compares the two i-codes. If both i-codes match, the key is considered to be valid.
Now - this is no real problem - I've converted the code to C and it works fine for code checking. What I'd like to do is convert the i-code from the username into the 4-character key. The code that generates the i-code for the key is as follows:
Can anyone tell me how I might be able to reverse this part of the algorithm into an "i-code to key" routine? Code would be nice, but I'd prefer some form of "OK, this does [x], so turn it into [y] because [z]" type text, i.e. a basic tutorial.
I suppose I could write a brute-force key generator, but I'm not too keen on that idea (the quickest way is not always the best - bruteforcers are too slow IMO).
Thanks.
I'm currently trying to write my first "real" keygen. The algorithm - FWICT - takes the username, produces an intermediate code (i-code). Next, it generates another i-code based on the key (a 4-character Base 18 code) and compares the two i-codes. If both i-codes match, the key is considered to be valid.
Now - this is no real problem - I've converted the code to C and it works fine for code checking. What I'd like to do is convert the i-code from the username into the 4-character key. The code that generates the i-code for the key is as follows:
Code:
unsigned int StrToWord(char *inp)
{
const char conversion[] = "BCDFGJKLMPQRSTVWXZ";
char input[10];
int loop;
signed long r0;
unsigned long r1, r5;
char *pdest;
strcpy(input, inp);
r5 = 0;
for (loop = 4; loop>0; loop--)
{
pdest = strchr(conversion, inp[loop-1]);
r0 = pdest - conversion;
r1 = (unsigned long) ((loop << 3) - loop);
r0 = r0 - r1;
while (r0 < 0) r0 += 0x12;
r1 = r5 + (r5 << 3);
r5 = r0 + (r1 << 1);
}
return (unsigned int)(r5 & 0xFFFF);
}
Can anyone tell me how I might be able to reverse this part of the algorithm into an "i-code to key" routine? Code would be nice, but I'd prefer some form of "OK, this does [x], so turn it into [y] because [z]" type text, i.e. a basic tutorial.
I suppose I could write a brute-force key generator, but I'm not too keen on that idea (the quickest way is not always the best - bruteforcers are too slow IMO).
Thanks.