benilla-re systems structs docs

DecryptBlock

function · storm · primitive

Address
0x651aa0 · 93 bytes, up to 0x651afc
Signature
void __fastcall (void *data, uint32_t bytes, uint32_t key)
Meaning
Decrypts whole dwords with the key stream seeded from the key
Confidence
verified, proof two
Finding
storm/format#decryption

Finding: Decryption in storm: the archive format

A block is decrypted dword by dword. The running value starts as 0xeeeeeeee; for each dword the key stream is added table[0x400 + (key & 0xff)], the dword is XORed with (running + key), running = running·0x21 + plain + 3, and key = ((~key << 0x15) + 0x11111111) | (key >> 0x0b). A file's key is the type 3 hash of its base name: the name after the last : and then after the last \, never /. With 0x20000 the key becomes (key + offset − header position) ^ unpacked size. The sector table uses the key − 1, and sector i the key + i.

The derivation is in the doc.

Callers 2

Callees 0

None by a direct call or jump.

Calls and jumps by a bare address, from tables/calls.tsv.