#hasher #deterministic #default #ult-hasher #deterministic-def

deterministic_default_hasher

A deterministic initialisation of the stdlib default hasher

8 releases (4 breaking)

0.14.2 Apr 8, 2025
0.14.1 Apr 4, 2025
0.14.0 Mar 28, 2025
0.13.0 Mar 27, 2025
0.5.0 Nov 15, 2024

#710 in Rust patterns

Download history 7/week @ 2024-12-26 7/week @ 2025-01-02 8/week @ 2025-01-09 324/week @ 2025-01-16 42/week @ 2025-01-23 20/week @ 2025-01-30 22/week @ 2025-02-06 16/week @ 2025-02-13 16/week @ 2025-02-20 33/week @ 2025-02-27 58/week @ 2025-03-06 31/week @ 2025-03-13 8/week @ 2025-03-20 297/week @ 2025-03-27 280/week @ 2025-04-03 57/week @ 2025-04-10

645 downloads per month
Used in 7 crates (2 directly)

BSD-2-Clause

3KB

Deterministic default hasher

Annoyed by your rust hashtables behaving differently each execution, and making reproducing bugs a matter of luck? Worry no more, simply use the deterministic default hasher, which is nothing else than a special constructor for the default hasher that always chooses the same seed, instead of using a random one.

Example

use deterministic_default_hasher::DeterministicDefaultHasher;

let map = HashMap::<String, usize, DeterministicDefaultHasher>::new();

The third argument defaults to DefaultHasher. Using DeterministicDefaultHasher instead makes the hash map deterministic.

No runtime deps