benilla-re systems structs docs

SStrHash

function · storm · primitive

Address
0x64af90 · 199 bytes, up to 0x64b056
Signature
uint32_t __stdcall (const char *text, uint32_t flags, uint32_t seed)
Meaning
Hashes a string with a seed and a table of sixteen dwords, case and slashes folded unless flag 1
Confidence
verified, proof two
Name from
the community database (idb)
Finding
storm/strings#seeded-string-hash
Test
storm::str_hash

Finding: Seeded string hash in storm: string conversions

SStrHash(text, flags, seed) (0x64af90) hashes a name for the texture, sound, map object and language caches. s1 starts at the seed, or 0x7fed7fed for a seed of 0, and s2 at 0xeeeeeeee. With flag bit 0 clear each byte is first folded, a to z down by 0x20 and / to \. For each byte c before the NUL, modulo 2^32: s1 = (s1 + s2) ^ (T[c >> 4] − T[c & 15]), then s2 = s2·33 + c + s1 + 3, with T the sixteen dwords at 0x80e4e0. A result of 0 is returned as 1; a null text sets error 0x57 and returns 0. Every caller passes flags 0 and seed 0.

The derivation is in the doc.

Callers 7

Callees 1

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