Struct blake2b_simd::Params

source ·
pub struct Params { /* private fields */ }
Expand description

A parameter builder for State that exposes all the various BLAKE2 features.

Apart from hash_length, which controls the length of the final Hash, all of these parameters are just associated data that gets mixed with the input. For all the details, see the BLAKE2 spec.

Several of the parameters have a valid range defined in the spec and documented below. Trying to set an invalid parameter will panic.

Example

let mut state = Params::new().hash_length(32).to_state();

Implementations§

Equivalent to Params::default().

Construct a State object based on these parameters.

Set the length of the final hash, from 1 to OUTBYTES (64). Apart from controlling the length of the final Hash, this is also associated data, and changing it will result in a totally different hash.

Use a secret key, so that BLAKE2b acts as a MAC. The maximum key length is KEYBYTES (64). An empty key is equivalent to having no key at all.

At most SALTBYTES (16). Shorter salts are padded with null bytes. An empty salt is equivalent to having no salt at all.

At most PERSONALBYTES (16). Shorter personalizations are padded with null bytes. An empty personalization is equivalent to having no personalization at all.

From 0 (meaning unlimited) to 255. The default is 1 (meaning sequential).

From 1 (the default, meaning sequential) to 255 (meaning unlimited).

From 0 (the default, meaning unlimited or sequential) to 2^32 - 1.

From 0 (the default, meaning first, leftmost, leaf, or sequential) to 2^64 - 1.

From 0 (the default, meaning leaf or sequential) to 255.

From 0 (the default, meaning sequential) to OUTBYTES (64).

Indicates the rightmost node in a row. This can also be changed on the State object itself, potentially after hashing has begun. See State::set_last_node.

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

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

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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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.