ahash::random_state

Trait RandomSource

source
pub trait RandomSource {
    // Required method
    fn gen_hasher_seed(&self) -> usize;
}
Expand description

A supplier of Randomness used for different hashers. See set_random_source.

If set_random_source aHash will default to the best available source of randomness. In order this is:

  1. OS provided random number generator (available if the runtime-rng flag is enabled which it is by default) - This should be very strong.
  2. Strong compile time random numbers used to permute a static “counter”. (available if compile-time-rng is enabled. Enabling this is recommended if runtime-rng is not possible)
  3. A static counter that adds the memory address of each RandomState created permuted with fixed constants. (Similar to above but with fixed keys) - This is the weakest option. The strength of this heavily depends on whether or not ASLR is enabled. (Rust enables ASLR by default)

Required Methods§

Implementors§