s_uEncryptionKey is 1024 uint values.
should be combined into 4096 byte xor key.
that xores the file starting at offset 12
Code: Select all
set MEMORY_FILE10 string "
typedef unsigned int u32;
u32 s_uEncryptedPvrKeyParts [4];
u32 s_uEncryptionKey [1024];
u32 MX(u32 z, u32 y, u32 p, u32 e, u32 sum) {
return (((z >> 5 ^ y << 2) + (y >> 3 ^ z << 4)) ^ ((sum ^ y) + (s_uEncryptedPvrKeyParts[(p & 3) ^ e] ^ z)));
}
void SetKey(u32 key1, u32 key2, u32 key3, u32 key4) {
s_uEncryptedPvrKeyParts[0] = key1;
s_uEncryptedPvrKeyParts[1] = key2;
s_uEncryptedPvrKeyParts[2] = key3;
s_uEncryptedPvrKeyParts[3] = key4;
}
void InitializeKey() {
unsigned int enclen = 1024;
unsigned int y, p, e;
unsigned int rounds = 6;
unsigned int sum = 0;
unsigned int z = s_uEncryptionKey[enclen - 1];
do
{
unsigned int DELTA = 0x9e3779b9;
sum += DELTA;
e = (sum >> 2) & 3;
for (p = 0; p < enclen - 1; p++)
{
y = s_uEncryptionKey[p + 1];
z = s_uEncryptionKey[p] += MX(z, y, p, e, sum);
}
y = s_uEncryptionKey[0];
z = s_uEncryptionKey[enclen - 1] += MX(z, y, p, e, sum);
} while (--rounds > 0);
}
void decrypt(unsigned char *buff, int size, u32 key1, u32 key2, u32 key3, u32 key4) {
SetKey(key1, key2, key3, key4);
InitializeKey();
//int i;
//for(i = 0; i < size; i++) {
// buff[i] ^= RandXor128();
//}
}
"
get SIZE asize
log MEMORY_FILE 0 SIZE
calldll MEMORY_FILE10 decrypt tcc RET MEMORY_FILE SIZE 0xF68C6273 0x07C32116 0x4AF4F1AC 0xBF0988A6
log "dump.dat" 0 SIZE MEMORY_FILE