[−][src]Struct fasthash::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 correspondingHashMap
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 Copy for Seed
[src]
impl From<Seed> for u32
[src]
impl From<Seed> for u64
[src]
impl From<Seed> for (u64, u64)
[src]
impl From<Seed> for (u64, u64, u64, u64)
[src]
impl From<Seed> for u128
[src]
impl Clone for Seed
[src]
fn clone(&self) -> Seed
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Seed
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,