viewing paste Unknown #6600 | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include <stdio.h>
 
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;
    printf("\nTesting packetver %d\n", PACKETVER);
    do {
        printf("key %02d: 0x%08x: %s\n", i++, sdcryptKey, sdcryptKey == prevKey ? "REPEATED!!" : "Fresh");
        prevKey = sdcryptKey;
        sdcryptKey = (( sdcryptKey * cryptKey[1] ) + cryptKey[2]) & 0xFFFFFFFF;
    } while (i < 100);
}
 
Viewed 1076 times, submitted by Guest.