Struct blake2::Blake2sMac

source ·
pub struct Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,
{ /* private fields */ }
Expand description

Blake2s MAC function

Implementations§

source§

impl<OutSize> Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

source

pub fn new_with_salt_and_personal( key: &[u8], salt: &[u8], persona: &[u8] ) -> Result<Self, InvalidLength>

Create new instance using provided key, salt, and persona.

§Errors

Key length should not be empty or bigger than the block size and the salt and persona length should not be bigger than quarter of block size. If any of those conditions is false the method will return an error.

Trait Implementations§

source§

impl<OutSize> Clone for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32> + Clone, LeEq<OutSize, U32>: NonZero,

source§

fn clone(&self) -> Blake2sMac<OutSize>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<OutSize> Debug for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<OutSize> Drop for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<OutSize> FixedOutput for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32> + 'static, LeEq<OutSize, U32>: NonZero,

source§

fn finalize_into(self, out: &mut Output<Self>)

Consume value and write result into provided array.
source§

fn finalize_fixed(self) -> Array<u8, Self::OutputSize>

Retrieve result and consume the hasher instance.
source§

impl<OutSize> FixedOutputReset for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

Available on crate feature reset only.
source§

fn finalize_into_reset(&mut self, out: &mut Output<Self>)

Write result into provided array and reset the hasher state.
source§

fn finalize_fixed_reset(&mut self) -> Array<u8, Self::OutputSize>

Retrieve result and reset the hasher state.
source§

impl<OutSize> KeyInit for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

source§

fn new(key: &Key<Self>) -> Self

Create new value from fixed size key.
source§

fn new_from_slice(key: &[u8]) -> Result<Self, InvalidLength>

Create new value from variable size key.
source§

impl<OutSize> KeySizeUser for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

§

type KeySize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>

Key size in bytes.
§

fn key_size() -> usize

Return key size in bytes.
source§

impl<OutSize> OutputSizeUser for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32> + 'static, LeEq<OutSize, U32>: NonZero,

§

type OutputSize = OutSize

Size of the output in bytes.
§

fn output_size() -> usize

Return output size in bytes.
source§

impl<OutSize> Reset for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

Available on crate feature reset only.
source§

fn reset(&mut self)

Reset state to its initial value.
source§

impl<OutSize> Update for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

source§

fn update(&mut self, input: &[u8])

Update state using the provided data.
source§

fn chain(self, data: impl AsRef<[u8]>) -> Self
where Self: Sized,

Digest input data in a chained manner.
source§

impl<OutSize> MacMarker for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

source§

impl<OutSize> ZeroizeOnDrop for Blake2sMac<OutSize>
where OutSize: ArraySize + IsLessOrEqual<U32>, LeEq<OutSize, U32>: NonZero,

Available on crate feature zeroize only.

Auto Trait Implementations§

§

impl<OutSize> RefUnwindSafe for Blake2sMac<OutSize>
where OutSize: RefUnwindSafe,

§

impl<OutSize> Send for Blake2sMac<OutSize>
where OutSize: Send,

§

impl<OutSize> Sync for Blake2sMac<OutSize>
where OutSize: Sync,

§

impl<OutSize> Unpin for Blake2sMac<OutSize>
where OutSize: Unpin,

§

impl<OutSize> UnwindSafe for Blake2sMac<OutSize>
where OutSize: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<D> DynDigest for D
where D: Update + FixedOutputReset + Reset + Clone + 'static,

source§

fn update(&mut self, data: &[u8])

Digest input data. Read more
source§

fn finalize_reset(&mut self) -> Box<[u8]>

Available on crate feature alloc only.
Retrieve result and reset hasher instance
source§

fn finalize(self: Box<D>) -> Box<[u8]>

Available on crate feature alloc only.
Retrieve result and consume boxed hasher instance
source§

fn finalize_into(self, buf: &mut [u8]) -> Result<(), InvalidBufferSize>

Write result into provided array and consume the hasher instance. Read more
source§

fn finalize_into_reset( &mut self, buf: &mut [u8] ) -> Result<(), InvalidBufferSize>

Write result into provided array and reset the hasher instance. Read more
source§

fn reset(&mut self)

Reset hasher instance to its initial state.
source§

fn output_size(&self) -> usize

Get output size of the hasher
source§

fn box_clone(&self) -> Box<dyn DynDigest>

Available on crate feature alloc only.
Clone hasher state into a boxed trait object
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Mac for T

source§

fn update(&mut self, data: &[u8])

Update state using the provided data.
source§

fn chain_update(self, data: impl AsRef<[u8]>) -> T

Process input data in a chained manner.
source§

fn finalize(self) -> CtOutput<T>

Obtain the result of a Mac computation as a CtOutput and consume Mac instance.
source§

fn finalize_reset(&mut self) -> CtOutput<T>

Obtain the result of a Mac computation as a CtOutput and reset Mac instance.
source§

fn reset(&mut self)
where T: Reset,

Reset MAC instance to its initial state.
source§

fn verify( self, tag: &Array<u8, <T as OutputSizeUser>::OutputSize> ) -> Result<(), MacError>

Check if tag/code value is correct for the processed input.
source§

fn verify_reset( &mut self, tag: &Array<u8, <T as OutputSizeUser>::OutputSize> ) -> Result<(), MacError>

Check if tag/code value is correct for the processed input and reset Mac instance.
source§

fn verify_slice(self, tag: &[u8]) -> Result<(), MacError>

Check truncated tag correctness using all bytes of calculated tag. Read more
source§

fn verify_slice_reset(&mut self, tag: &[u8]) -> Result<(), MacError>

Check truncated tag correctness using all bytes of calculated tag and reset Mac instance. Read more
source§

fn verify_truncated_left(self, tag: &[u8]) -> Result<(), MacError>

Check truncated tag correctness using left side bytes (i.e. tag[..n]) of calculated tag. Read more
source§

fn verify_truncated_right(self, tag: &[u8]) -> Result<(), MacError>

Check truncated tag correctness using right side bytes (i.e. tag[n..]) of calculated tag. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.