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

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <string.h>
  5.  
  6. unsigned char cypher[] = "4MW7UFHPD5BK8R2TYVN3QCSAG9EZLJ6X";
  7. unsigned char sern[] = "GMM-AA-REVNET-0000-0000";
  8. unsigned char key[] = "B82YZ2222VKRTVF4444JM7FPWWUHD7L2";
  9.  
  10. // 0 0 0 0 - Group 0 = Maximum groups (pos in key 10..13)
  11. // 1 1 1 1 - Group 1 = First half of serial# (pos in key 5..8)
  12. // 2 2 2 2 - Group 2 = Maximum members (pos in key 0..3)
  13. // 3 3 3 3 - Group 3 = Second half of serial# (pos in key 15..18)
  14. //
  15. // Pos in key 25..28 are subtracted from Groups 0 and 1
  16. // Pos in key 20..23 are subtracted from Groups 2 and 3
  17. // All the rest eval. to "AAREVNET" as follows [30]-5, [9]+6, [14]+8, [29]-9, [4]-10, [19]-11, [31]+12, [24]+13
  18. //
  19. // See xlatpos() for proper digit-group placement
  20. //
  21.  
  22. int xlatpos(int pos, int grp)
  23. {
  24.     pos -= grp;
  25.     if (pos < 0)
  26.         pos += 4;
  27.  
  28.     return pos;
  29. }
  30.  
  31. int lookup(char let)
  32. {
  33.     int i=0;
  34.  
  35.     while (cypher[i] && cypher[i] != let)
  36.         i++;
  37.  
  38.     return i;
  39. }
  40.  
  41. void makekey()
  42. {
  43.     int i, num;
  44.  
  45.  
  46.     for (i=0; i<4; i++) {
  47.         num = random(10);
  48.         sern[14 + i] += num;
  49.         key[5 + xlatpos(i, 1)] = cypher[ lookup(key[25 + xlatpos(i, 1)]) + num ];
  50.  
  51.         num = random(10);
  52.         sern[19 + i] += num;
  53.         key[15 + xlatpos(i, 3)] = cypher[ lookup(key[20 + xlatpos(i, 3)]) + num ];
  54.     }
  55. }
  56.  
  57. void main()
  58. {
  59.     printf("GroupMaster v1.4 Serial# and Software Key generator\n");
  60.     randomize();
  61.     makekey();
  62.     printf("\n");
  63.     printf("Serial Number : %s\n", sern);
  64.     printf("Software Key  : %s\n", key);
  65. }
  66.