Advertisement
Guest User

Game Keygen

a guest
Aug 10th, 2024
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.22 KB | None | 0 0
  1. //Generates valid registration keys for a game on the PocketPC
  2. #include<iostream>
  3. #include<ctime>
  4.  
  5. const char gameId[] = {'D', 'A', 'T', 'A'};
  6.  
  7. char to_char(char i) {
  8.     if(i>=36) return 0;
  9.     if(i<10) return char(i)+'0';
  10.     return i-10+'A';
  11. }
  12.  
  13. int main() {
  14.     unsigned char ikeys[8];
  15.     unsigned int a[6];
  16.     unsigned int u1 = gameId[0] + gameId[1];
  17.     unsigned int u2 = gameId[2] + gameId[3];
  18.     srand(time(NULL));
  19.     for(int i=0;i<8;++i)
  20.         ikeys[i] = rand() % 0x24;
  21.     a[0] = (ikeys[0] + ikeys[1] + ikeys[2] + ikeys[3]) % 0x24;
  22.     a[1] = (ikeys[4] + ikeys[5] + ikeys[6] + ikeys[7]) % 0x24;
  23.  
  24.     a[2] = (ikeys[0] * ikeys[1] * ikeys[2] * ikeys[3]) % 0x24;
  25.     a[3] = (ikeys[4] * ikeys[5] * ikeys[6] * ikeys[7]) % 0x24;
  26.  
  27.     a[4] = (a[0] * u1) % 0x24;
  28.     a[5] = (a[1] * u2) % 0x24;
  29.  
  30.     char skeys[] = { to_char(ikeys[0]), to_char(ikeys[4]), to_char(a[2]),
  31.                      to_char(ikeys[1]), to_char(ikeys[5]), to_char(a[3]),
  32.                      to_char(ikeys[2]), to_char(ikeys[6]), to_char(a[4]),
  33.                      to_char(ikeys[3]), to_char(ikeys[7]), to_char(a[5]) };
  34.  
  35.     std::cout << "Random valid key: ";
  36.     for(auto c: skeys) std::cout << c << " ";
  37.     std::cout << '\n';
  38. }
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement