#include int main() { unsigned int cryptKey[3] = {0,0,0}; unsigned int sdcryptKey, prevKey = 0; int i = 0; # define packetKeys(a,b,c) { cryptKey[0] = a; cryptKey[1] = b; cryptKey[2] = c; } #ifndef PACKETVER # define PACKETVER 20120418 #endif # include "src/map/packets.h" sdcryptKey = (( cryptKey[0] * cryptKey[1] ) + cryptKey[2]) & 0xFFFFFFFF; do { if (sdcryptKey == prevKey) { printf("Packetver %d repeats key %08x after %d iterations.\n", PACKETVER, sdcryptKey, i); return 1; } i++; prevKey = sdcryptKey; sdcryptKey = (( sdcryptKey * cryptKey[1] ) + cryptKey[2]) & 0xFFFFFFFF; } while (i < 1000000); printf("Packetver %d is safe for at least %d iterations\n", PACKETVER, i); return 0; }