home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
-
- char key[10] = "ljlkajdf l";
-
- void p5hexes(unsigned char* buf, unsigned char* xorbuf)
- {
- int i;
-
- for (i=0; i<5; i++)
- printf("%02x", buf[i] ^ xorbuf[i]);
- }
-
- int main()
- {
- int un, i, sl, i2;
- union {
- char c[10];
- short int i[5];
- struct {
- short int users;
- short int flags;
- short int time;
- short int seed;
- short int val1;
- } s;
- } lickey;
- unsigned int csum = 0;
- char deckey[100], val[10];
-
- printf("IChat Message Boards Server 1.0 License Key Generator\n");
- printf("Enter number of users : ");
- scanf("%d", &un);
-
- randomize();
- lickey.s.seed = random(5000) + 150;
- lickey.s.time = lickey.s.seed;
- lickey.s.users = lickey.s.seed + un;
- lickey.s.flags = 6;
- lickey.s.val1 = 3;
-
- *deckey = 0;
- for (i=0; i<5; i++)
- strcat(deckey, itoa(lickey.i[i], val, 10));
- // printf("%s\n", deckey);
-
- sl = strlen(deckey);
- for (i=0; i<sl; i++) {
- if (csum & 1)
- csum >>= 1, csum += 0x80;
- else
- csum >>= 1;
- csum += deckey[i];
- }
- // printf("checksum = %02x\n", csum);
-
- swab(lickey.c, lickey.c, 10);
- lickey.c[8] = (char)csum;
-
- printf("\nLicense Key : ");
- p5hexes(lickey.c, key);
- printf(":");
- p5hexes(lickey.c+5, key+5);
- printf("\n");
-
- return 0;
- }