/* The following is the simple algorithm used by Quake 3 to check the CD-Keys by Luigi Auriemma e-mail: aluigi@autistici.org web: aluigi.org */ #define OKKO "\x00\x00\x01\x01\x01\x00\x01\x01" \ "\x01\x01\x01\x01\x01\x01\x01\x00" \ "\x00\x00\x00\x01\x01\x00\x00\x01" \ "\x00\x01\x00\x01\x01\x01\x00\x01" \ "\x00\x00\x00\x01\x01\x00" /* OKKO: */ /* if 0: ok */ /* if 1: wrong key */ char cdkey[], // cdkey of 16 chars (0-9, A-Z) *ptr; // pointer int i; // counter unsigned char ecx; // register ptr = cdkey; for(i = 0; i < 16; i++) { if((*ptr >= 0x61) && (*ptr <= 0x7a)) *ptr -= 32; ecx = *ptr - 0x32; if(ecx > 0x25) break; if(OKKO[ecx]) break; ptr++; } if(i == 16) fputs("\nYour Cd-Key is OK\n", stdout); else fputs("\nYour Cd-Key is invalid\n", stdout);