Skip to main content

Module hash

Module hash 

Source
Expand description

The hash a determinism check folds: FNV-1a 64.

FNV-1a 64 is what the games’ hand-rolled session digests already used, so the engine and a game agree on a digest and nothing new is pulled in for it. It is a change detector, not a cryptographic hash: state nobody folds does not move it, and a crafted collision is possible. Use it to find where two runs differ, not to prove they cannot.

Determinism rule: every value is folded as its bytes, little-endian, one byte at a time, in the order the caller wrote it. usize/isize fold as u64/i64, so a 32-bit wasm build folds the same bytes as a 64-bit desktop build for the same value, and a float folds its to_bits, so the digest is bit-exact rather than approximate (0.0 and -0.0 differ, NaN payloads included). Strings are length-prefixed, so two short strings cannot fold like one long one. Unlike std’s DefaultHasher, nothing here is seeded per process: a digest computed in one run means the same thing in the next.

Structs§

Hash64
A streaming FNV-1a 64 digest: write values in a fixed order, read digest.

Functions§

fnv1a64
FNV-1a 64 over bytes.