home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / Quantico / km / icmb10lk.c.txt < prev    next >
Encoding:
Text File  |  2000-05-25  |  1.2 KB  |  68 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. char key[10] = "ljlkajdf l";
  6.  
  7. void p5hexes(unsigned char* buf, unsigned char* xorbuf)
  8. {
  9.     int i;
  10.  
  11.     for (i=0; i<5; i++)
  12.         printf("%02x", buf[i] ^ xorbuf[i]);
  13. }
  14.  
  15. int main()
  16. {
  17.     int un, i, sl, i2;
  18.     union {
  19.         char c[10];
  20.         short int i[5];
  21.         struct {
  22.             short int users;
  23.             short int flags;
  24.             short int time;
  25.             short int seed;
  26.             short int val1;
  27.         } s;
  28.     } lickey;
  29.     unsigned int csum = 0;
  30.     char deckey[100], val[10];
  31.  
  32.     printf("IChat Message Boards Server 1.0 License Key Generator\n");
  33.     printf("Enter number of users : ");
  34.     scanf("%d", &un);
  35.  
  36.     randomize();
  37.     lickey.s.seed = random(5000) + 150;
  38.     lickey.s.time = lickey.s.seed;
  39.     lickey.s.users = lickey.s.seed + un;
  40.     lickey.s.flags = 6;
  41.     lickey.s.val1 = 3;
  42.  
  43.     *deckey = 0;
  44.     for (i=0; i<5; i++)
  45.         strcat(deckey, itoa(lickey.i[i], val, 10));
  46. //    printf("%s\n", deckey);
  47.  
  48.     sl = strlen(deckey);
  49.     for (i=0; i<sl; i++) {
  50.         if (csum & 1)
  51.             csum >>= 1, csum += 0x80;
  52.         else
  53.             csum >>= 1;
  54.         csum += deckey[i];
  55.     }
  56. //    printf("checksum = %02x\n", csum);
  57.  
  58.     swab(lickey.c, lickey.c, 10);
  59.     lickey.c[8] = (char)csum;
  60.  
  61.     printf("\nLicense Key : ");
  62.     p5hexes(lickey.c, key);
  63.     printf(":");
  64.     p5hexes(lickey.c+5, key+5);
  65.     printf("\n");
  66.  
  67.     return 0;
  68. }