re: recover the IDXD record-key / field-tag hash (8643/8643)
Closes the 4-byte record key. tag_hash is name_hash's shape -- byte-sum checksum in the top byte over a 24-bit modular polynomial -- with two different constants: modulus 0x00FFFFDF (2^24-33, prime) instead of 0x00FFF9D7, and no lowercasing, so tags are case-sensitive. name_hash explains 0 of 8643. Recovered from the tables rather than the executable: every inline field name is a known (name -> tag) pair, and comparing names differing in one character gives the per-position weights 1, 0x100, 0x10000, 0x21, 0x2100, ... -- a byte leaving bit 24 re-enters as 33, i.e. reduction mod 2^24-33. Holds where it is easy to get wrong (distance 8 and 9 carry correctly). A record's key is the tag of its own name: FormationSet rosters 362/362, UnitGroup rosters 281/281, S02 squadron names 111/111 -- so records can be addressed by name without reading the roster first. Implemented in Python (unitgroup.tag_hash) and Rust (sylpheed_formats::hash::tag_hash) with 3 new unit tests carrying disc-derived vectors; cargo test -p sylpheed-formats --lib hash is 8/8 green. Not settled: the guest routine is unlocated, so this uses exact modular arithmetic where the game may use a Barrett step without final fixup.
This commit is contained in:
22
docs/re/data/idxd-tag-hash.txt
Normal file
22
docs/re/data/idxd-tag-hash.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
# IDXD record-key / field-tag hash — verification over the whole pak
|
||||
|
||||
tag_hash(s) = ((sum(bytes) & 0xff) << 24) | (base-256 polynomial mod 0x00FFFFDF)
|
||||
|
||||
named fields with a unique tag in GP_MAIN_GAME_E.pak : 8643
|
||||
tag_hash exact : 8643
|
||||
wrong : 0
|
||||
name_hash exact (the OTHER hash, for contrast) : 0
|
||||
|
||||
sample (name -> tag):
|
||||
AAGunShellID 31dd1a13
|
||||
AA_AxisMode_Max 80b0d604
|
||||
AA_AxisMode_Min 7eb0ddfa
|
||||
AA_PitchMinus_Max 6a133241
|
||||
AA_PitchMinus_Min 68133a37
|
||||
AA_PitchPlus_Max 028ab283
|
||||
AA_PitchPlus_Min 008aba79
|
||||
AA_Roll_Max ff8d842e
|
||||
AA_Roll_Min fd8d8c24
|
||||
AA_Yaw_Max 97182874
|
||||
AA_Yaw_Min 9518306a
|
||||
AB_AA_PitchMinus c78e8fdd
|
||||
Reference in New Issue
Block a user