Struct fasthash::Seed
[−]
[src]
pub struct Seed(_);
Generate hash seeds
It base on the same workflow from std::collections::RandomState
Historically this function did not cache keys from the OS and instead simply always called
rand::thread_rng().gen()
twice. In #31356 it was discovered, however, that because we re-seed the thread-local RNG from the OS periodically that this can cause excessive slowdown when many hash maps are created on a thread. To solve this performance trap we cache the first set of randomly generated keys per-thread.Later in #36481 it was discovered that exposing a deterministic iteration order allows a form of DOS attack. To counter that we increment one of the seeds on every RandomState creation, giving every corresponding HashMap a different iteration order.
Examples
use fasthash::{Seed, city}; city::hash128_with_seed(b"hello world", Seed::gen().into());
Methods
impl Seed
[src]
Trait Implementations
impl Clone for Seed
[src]
fn clone(&self) -> Seed
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more