Project-Path-of-Exile-Wiki / PyPoE

Collection of Python Tools for Path of Exile
GNU General Public License v3.0
24 stars 21 forks source link

Add support for new hash algorithm #113

Closed zao closed 1 year ago

zao commented 1 year ago

Abstract

In Path of Exile 3.21.2 the method of computing the hash for paths has changed significantly where the hash algorithm went from FNV1A64 to MurmurHash64A with a custom seed. The logic transforming pathnames before hashing also changed with the new file and directory paths always being lowercase, without any trailing slashes and without the old suffix of ++.

Action Taken

New logic for hashing pathnames was added while retaining the old way for legacy data. The algorithm and seed is auto-detected from the hash of the root directory as it hashes a known zero-length string. The hash algorithm is in pure Python and lifted from https://github.com/lvlvllvlvllvlvl/PyPoE/commit/f5c4263408b79c2c74029b45254c2e5a385d8c46 .

Caveats

While the new seed is known in advance this code derives it mathematically from the directory entries present in the index file to make it more resilient against future seed changes. This has a small computational cost when opening the index on program startup.

~This change introduces a new dependency on mmhash2 to compute the new hashes - existing installations need to re-run pip install -e . to obtain and install the new dependency.~

FAO