Skip to main content

Module det_hash

Module det_hash 

Source
Expand description

Deterministic hashing primitives.

The standard-library HashMap/HashSet seed their hasher from a process-global source, so iteration order — and therefore any algorithm whose output depends on the order it visits map entries — varies between runs (and even between successive map instances within one process, since the seed counter advances per instance). For geometry kernels this surfaces as nondeterministic mesh welding and triangulation: the same input can produce different vertex merges and face counts run-to-run.

DetHashMap / DetHashSet use a fixed-seed FNV-1a hasher so iteration order is fully reproducible for a given set of keys. Use them anywhere map iteration order feeds geometry construction (vertex welds, triangulation, shell assembly).

§Security

This is a deterministic, fixed-seed FNV-1a hasher. It is not DoS-resistant: an adversary who controls the keys can trivially force collisions. Use it only for internal geometry processing where keys are derived from trusted topology, never for attacker-controlled input.

Structs§

DetHasher
Fixed-seed FNV-1a hasher. Deterministic across processes and instances.
DetState
BuildHasher for DetHasher, seeding each hasher at the FNV-1a offset.

Type Aliases§

DetHashMap
A HashMap with deterministic, reproducible iteration order.
DetHashSet
A HashSet with deterministic, reproducible iteration order.