logo
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

Create a new SipHasher (equivalent to from_keys(0, 0)).

Create a SipHasher using the given keys.

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

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.

For portability reasons, the usize input is interpreted as a u128.

For portability reasons, the isize input is interpreted as a i128.

Returns the hash value for the values written so far. Read more

Writes some data into this Hasher. Read more

Writes a single u8 into this hasher.

Writes a single u16 into this hasher.

Writes a single u32 into this hasher.

Writes a single u64 into this hasher.

Writes a single u128 into this hasher.

Writes a single i8 into this hasher.

Writes a single i16 into this hasher.

Writes a single i32 into this hasher.

Writes a single i64 into this hasher.

Writes a single i128 into this hasher.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.