Sje.jhh: Difference between revisions

From Hard Drop Tetris Wiki

Jump to: navigation, search
 
(10 intermediate revisions by 2 users not shown)
Line 12: Line 12:


* 4 bytes - number of entries
* 4 bytes - number of entries
* 4 bytes - unknown
* 4 bytes - length of path string
* string - path
* string - path
* 4 bytes - unknown
* [entries]
* string - entry 1 filename
* 4 bytes - entry 1 offset
* 4 bytes - entry 1 length
* 4 bytes - unknown
* string - entry 2 filename
* 4 bytes - entry 2 offset
* 4 bytes - entry 2 length
* 4 bytes - unknown
* string - entry 3 filename
...
* 4 bytes - unknown
* string - last entry filename
* 4 bytes - last entry offset
* 4 bytes - last entry length


I just got idea that unknowns might be version numbers of files, but I need to check if it's true.
== Entry format ==


== Encyption ==
* 4 bytes - length of entry filename string
* string - entry filename
* 4 bytes - entry data offset
* 4 bytes - entry data length
 
== Index encryption ==


[http://en.wikipedia.org/wiki/Rc4 Rc4 stream cipher] is used.
[http://en.wikipedia.org/wiki/Rc4 Rc4 stream cipher] is used.
Line 42: Line 33:
CryptAcquireContext(&hCryptProv, NULL, MS_DEF_PROV, PROV_RSA_FULL, 0);
CryptAcquireContext(&hCryptProv, NULL, MS_DEF_PROV, PROV_RSA_FULL, 0);
CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, &hHash);
CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, &hHash);
CryptHashData(hHash, (BYTE *) password, 4, 0);
CryptHashData(hHash, (BYTE *) password, strlen(password), 0);
CryptDeriveKey(hCryptProv, CALG_RC4, hHash, 4, &hKey);
CryptDeriveKey(hCryptProv, CALG_RC4, hHash, 4, &hKey);
</pre>
</pre>
Line 57: Line 48:
3D 33 3E 71 2F DD ...
3D 33 3E 71 2F DD ...
</pre>
</pre>
== Content encryption ==
Text content files are encrypted too.
Encyption is same as index encryption, but "TOJ" password is used instead of "1111".
On 2010-06-14 password was changed to "dkaghdkagh".
On 2010-06-15 password was changed to 93 FA 96 7B 8C EA 01 20 82 CC 31 0D 0A 01 .

Latest revision as of 19:27, 25 June 2010

Game resource archive used by TOJ.


File format

  • 4 bytes - index section offset
  • 4 bytes - index section length
  • [data section]
  • [index section (encrypted)]

Index section format

  • 4 bytes - number of entries
  • 4 bytes - length of path string
  • string - path
  • [entries]

Entry format

  • 4 bytes - length of entry filename string
  • string - entry filename
  • 4 bytes - entry data offset
  • 4 bytes - entry data length

Index encryption

Rc4 stream cipher is used.

Encryption/decryption is done with advapi32 Crypt functions with following key and settings:

password = "1111";
CryptAcquireContext(&hCryptProv, NULL, MS_DEF_PROV, PROV_RSA_FULL, 0);
CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, &hHash);
CryptHashData(hHash, (BYTE *) password, strlen(password), 0);
CryptDeriveKey(hCryptProv, CALG_RC4, hHash, 4, &hKey);

First bytes of keystream are:

BA 38 72 06 03 1D 16 65
77 D3 28 EE 9D 12 40 44
8A DB B7 00 1B 3D C5 93
81 16 E2 21 62 8D 34 8A
70 28 30 A3 41 C5 F9 25
B0 AA 84 2A 34 3F BC 45
2F 8E 7B 7F D3 9D 75 DB
3D 33 3E 71 2F DD ...

Content encryption

Text content files are encrypted too. Encyption is same as index encryption, but "TOJ" password is used instead of "1111".

On 2010-06-14 password was changed to "dkaghdkagh".

On 2010-06-15 password was changed to 93 FA 96 7B 8C EA 01 20 82 CC 31 0D 0A 01 .