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:
- OS provided random number generator (available if the
runtime-rng
flag is enabled which it is by default) - This should be very strong. - Strong compile time random numbers used to permute a static “counter”. (available if
compile-time-rng
is enabled. Enabling this is recommended ifruntime-rng
is not possible) - 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)