Here's the snippet in the code and I was wondering if someone who understands how this works can explain it to me. I'd like to be able to to create my own productid.txt for my mod with my own text string. I understand the numbers are XOR'd I believe from that snippet of code and the numbers represent each letter in the productid.txt file. So please how does this work and where do you start? How does it generate 220 for the encryption that represents a capital T in the productid.txt file and so on? Any help is appreciated. Thanks.
Code: Select all
char *productId;
if ( !fs_restrict->integer ) {
// look for the full game id
FS_ReadFile( "productid.txt", (void **)&productId );
if ( productId ) {
// check against the hardcoded string
int seed, i;
seed = 5000;
for ( i = 0 ; i < sizeof( fs_scrambledProductId ) ; i++ ) {
if ( ( fs_scrambledProductId[i] ^ (seed&255) ) != productId[i] ) {
break;
}
seed = (69069 * seed + 1);
}
FS_FreeFile( productId );
if ( i == sizeof( fs_scrambledProductId ) ) {
return; // no restrictions
}
Com_Error( ERR_FATAL, "Invalid product identification" );
}
}
220, 129, 255, 108, 244, 163, 171, 55, 133, 65, 199, 36, 140, 222, 53, 99, 65, 171, 175, 232, 236, 193, 210, 250, 169, 104, 231, 231, 21, 201, 170, 208, 135, 175, 130, 136, 85, 215, 71, 23, 96, 32, 96, 83, 44, 240, 219, 138, 184, 215, 73, 27, 196, 247, 55, 139, 148, 68, 78, 203, 213, 238, 139, 23, 45, 205, 118, 186, 236, 230, 231, 107, 212, 1, 10, 98, 30, 20, 116, 180, 216, 248, 166, 35, 45, 22, 215, 229, 35, 116, 250, 167, 117, 3, 57, 55, 201, 229, 218, 222, 128, 12, 141, 149, 32, 110, 168, 215, 184, 53, 31, 147, 62, 12, 138, 67, 132, 54, 125, 6, 221, 148, 140, 4, 21, 44, 198, 3, 126, 12, 100, 236, 61, 42, 44, 251, 15, 135, 14, 134, 89, 92, 177, 246, 152, 106, 124, 78, 118, 80, 28, 42