I'm trying to implement the file table obfuscation algo from Boiling Point Road to Hell game *.grp archives.
Pseudocode getted from one of engine *.dll working fine for archives smallest then 2 gb, but wrong with biggest.
I wrote this simply C++ script for demonstrate:
Code: Select all
#include <stdio.h>
#include <stdlib.h>
int main()
{
unsigned int newgrpSize = 2859709129, newgrp1Size = 1168718524, initialValue = 47536;
unsigned char data[22] = {7, 211, 11, 95, 141, 76, 227, 180, 107, 133, 207, 242, 88, 9, 168, 238, 124, 46, 30, 15, 251, 38};
unsigned char data2[22] = { 31, 40, 102, 193, 185, 74, 118, 82, 147, 67, 151, 16, 205, 161, 54, 63, 230, 105, 167, 64, 171, 182 };
srand((newgrp1Size + initialValue | newgrp1Size + initialValue >> 31 << 32) % 65535);
for (int i = 0; i < 22; i++)
{
int v2 = rand();
data[i] ^= (v2 | v2 >> 31 << 32) % 255;
printf("%c", data[i]);
}
printf("\n");
srand((newgrpSize + initialValue | newgrpSize + initialValue >> 31 << 32) % 65535);
for (int i = 0; i < 22; i++)
{
int v2 = rand();
data2[i] ^= (v2 | v2 >> 31 << 32) % 255;
printf("%c", data2[i]);
}
}
data's chars represent obfuscated path strings cuted from tables of different archives. As seen in the result, after re-obfuscation first data looks like readable string, but data2 isnt.
Where might be issue?