Expand description
This module provides a deterministic hasher and HashMap and HashSet variants that use
it. The hashing data structures in the standard library are not deterministic:
By default, HashMap uses a hashing algorithm selected to provide resistance against HashDoS attacks. The algorithm is randomly seeded, and a reasonable best-effort is made to generate this seed from a high quality, secure source of randomness provided by the host without blocking the program.
The standard library HashMap has a new method, but HashMap<K, V, S> does not have a new
method by default. Use HashMap::default() instead to create a new hashmap with the default
hasher. If you really need to keep the API the same across implementations, we provide the
HashMapExt trait extension. Similarly, for HashSet and HashSetExt.The traits need only be
in scope.
Structs§
- FxHasher
- A speedy hash algorithm for use within rustc. The hashmap in liballoc by default uses SipHash which isn’t quite as speedy as we want. In the compiler we’re not really worried about DOS attempts, so we use a fast non-cryptographic hash.
- Index
SetIter - An iterator over the items of an [
IndexSet].
Traits§
- Hash
MapExt - Provides API parity with
std::collections::HashMap. - Hash
SetExt - Provides API parity with
std::collections::HashSet.
Functions§
- hash_
serialized_ 128 - hash_
str - A convenience method to compute the hash of a
&str. - one_
shot_ 128
Type Aliases§
- HashMap
- Type alias for a hash map that uses the Fx hashing algorithm.
- HashSet
- Type alias for a hash set that uses the Fx hashing algorithm.
- Hash
Value Type - Index
Set