Page 1 of 1

Problem with PAK-files: Hard To Be A God / Specnaz 2

Posted: Thu Feb 05, 2009 12:27 am
by asmxtx
I want to unpack PAK-files from these two games:

"Hard To Be A God" and
"Specnaz 2".

Both games use a similar file format with XOR-encryption.
The general structure of a PAK-file is:

<HEADER>
(XORed)<NUMBER_OF_FILES><FILE_TABLE_WITH_OFFSETS_AND_LENGTHS>
<DATA_AREA>

The filetable is XORed with a key (values see attachment).
Any first 100h bytes of a data entry are XORed with the same key.
After de-XORing the filetable one will recognize a well-known filename/offset/length-structure.

But that's not the problem.
The problem is the de-XORing of the first 100h bytes of a data entry, because the XOR-key starts with a relative offset, which is different for each data entry.

There must be a rule or formula for calculating this XOR-key-offset.

Has somebody got any clue or hint? Thank you in advance.

Re: Problem with PAK-files: Hard To Be A God / Specnaz 2

Posted: Thu Feb 05, 2009 11:25 am
by evin