[−][src]Struct blake2s_simd::Params
A parameter builder that exposes all the non-default 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 more 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
// Create a Params object with a secret key and a non-default length. let mut params = Params::new(); params.key(b"my secret key"); params.hash_length(16); // Use those params to hash an input all at once. let hash = params.hash(b"my input"); // Or use those params to build an incremental State. let mut state = params.to_state();
Implementations
impl Params
[src]
pub fn new() -> Self
[src]
Equivalent to Params::default()
.
pub fn hash(&self, input: &[u8]) -> Hash
[src]
Hash an input all at once with these parameters.
pub fn to_state(&self) -> Stateⓘ
[src]
Construct a State
object based on these parameters, for hashing input
incrementally.
pub fn hash_length(&mut self, length: usize) -> &mut Self
[src]
Set the length of the final hash in bytes, from 1 to OUTBYTES
(32). Apart from
controlling the length of the final Hash
, this is also associated data, and changing it
will result in a totally different hash.
pub fn key(&mut self, key: &[u8]) -> &mut Self
[src]
Use a secret key, so that BLAKE2 acts as a MAC. The maximum key length is KEYBYTES
(32).
An empty key is equivalent to having no key at all.
pub fn salt(&mut self, salt: &[u8]) -> &mut Self
[src]
At most SALTBYTES
(8). Shorter salts are padded with null bytes. An empty salt is
equivalent to having no salt at all.
pub fn personal(&mut self, personalization: &[u8]) -> &mut Self
[src]
At most PERSONALBYTES
(8). Shorter personalizations are padded with null bytes. An empty
personalization is equivalent to having no personalization at all.
pub fn fanout(&mut self, fanout: u8) -> &mut Self
[src]
From 0 (meaning unlimited) to 255. The default is 1 (meaning sequential).
pub fn max_depth(&mut self, depth: u8) -> &mut Self
[src]
From 0 (meaning BLAKE2X B2 hashes), through 1 (the default, meaning sequential) to 255 (meaning unlimited).
pub fn max_leaf_length(&mut self, length: u32) -> &mut Self
[src]
From 0 (the default, meaning unlimited or sequential) to 2^32 - 1
.
pub fn node_offset(&mut self, offset: u64) -> &mut Self
[src]
From 0 (the default, meaning first, leftmost, leaf, or sequential) to 2^48 - 1
.
pub fn node_depth(&mut self, depth: u8) -> &mut Self
[src]
From 0 (the default, meaning leaf or sequential) to 255.
pub fn inner_hash_length(&mut self, length: usize) -> &mut Self
[src]
From 0 (the default, meaning sequential) to OUTBYTES
(32).
pub fn last_node(&mut self, last_node: bool) -> &mut Self
[src]
Indicates the rightmost node in a row. This can also be changed on the
State
object, potentially after hashing has begun. See
State::set_last_node
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Params
impl Send for Params
impl Sync for Params
impl Unpin for Params
impl UnwindSafe for Params
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,