Struct rand_seeder::SipHasher
source · [−]pub struct SipHasher { /* private fields */ }
Expand description
A portable implementation of SipHash 2-4.
This implementation will produce 8-byte (u64
) output compliant with the
reference implementation. Additionally, it can be extended into an RNG able
to produce unlimited output via SipHasher::into_rng
.
See: https://131002.net/siphash/
SipHash is a general-purpose hashing function: it runs at a good speed (competitive with Spooky and City) and permits strong keyed hashing.
Although the SipHash algorithm is considered strong, it is not intended for cryptographic uses (e.g. authentication).
Implementations
sourceimpl SipHasher
impl SipHasher
sourcepub fn into_rng(self) -> SipRng
pub fn into_rng(self) -> SipRng
Finish writes and convert the hasher’s core into a generator.
This offers a fast, elegant transition from hash function to generator which maintains (up to) 256 bits of entropy.
Note that this transition has not been reviewed for cryptographic strength, and might break SipHash’s security.
Trait Implementations
sourceimpl Hasher for SipHasher
impl Hasher for SipHasher
Implements the standard library’s Hasher
trait.
Note that all methods are implemented directly to fix Endianness, unlike the default implementations in the standard library.
sourcefn write_usize(&mut self, i: usize)
fn write_usize(&mut self, i: usize)
For portability reasons, the usize
input is interpreted as a u128
.
sourcefn write_isize(&mut self, i: isize)
fn write_isize(&mut self, i: isize)
For portability reasons, the isize
input is interpreted as a i128
.
sourcefn write_u128(&mut self, i: u128)
fn write_u128(&mut self, i: u128)
Writes a single u128
into this hasher.
sourcefn write_i128(&mut self, i: i128)
fn write_i128(&mut self, i: i128)
Writes a single i128
into this hasher.
Auto Trait Implementations
impl RefUnwindSafe for SipHasher
impl Send for SipHasher
impl Sync for SipHasher
impl Unpin for SipHasher
impl UnwindSafe for SipHasher
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more