Sje.jhh: Difference between revisions

From Hard Drop Tetris Wiki

Jump to: navigation, search
mNo edit summary
 
(3 intermediate revisions by one other user not shown)
Line 23: Line 23:
* 4 bytes - entry data length
* 4 bytes - entry data length


== Index Encyption ==
== 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 49: Line 49:
</pre>
</pre>


== Content encyption ==
== Content encryption ==
Text content files are encrypted too.
Text content files are encrypted too.
Encyption is same as index encryption, but "TOJ" password is used instead of "1111".
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 .