Struct hmac::SimpleHmac

source ·
pub struct SimpleHmac<D: Digest + BlockSizeUser> { /* private fields */ }
Expand description

Simplified HMAC instance able to operate over hash functions which do not expose block-level API and hash functions which process blocks lazily (e.g. BLAKE2).

Trait Implementations§

source§

impl<D: Clone + Digest + BlockSizeUser> Clone for SimpleHmac<D>

source§

fn clone(&self) -> SimpleHmac<D>

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<D: Digest + BlockSizeUser + Debug> Debug for SimpleHmac<D>

source§

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

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

impl<D: Digest + BlockSizeUser> FixedOutput for SimpleHmac<D>

source§

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

Consume value and write result into provided array.
source§

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

Retrieve result and consume the hasher instance.
source§

impl<D: Digest + BlockSizeUser> KeyInit for SimpleHmac<D>

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§

fn generate_key( rng: impl CryptoRng + RngCore, ) -> GenericArray<u8, Self::KeySize>

Generate random key using the provided CryptoRng.
source§

impl<D: Digest + BlockSizeUser> KeySizeUser for SimpleHmac<D>

§

type KeySize = <D as BlockSizeUser>::BlockSize

Key size in bytes.
source§

fn key_size() -> usize

Return key size in bytes.
source§

impl<D: Digest + BlockSizeUser> OutputSizeUser for SimpleHmac<D>

§

type OutputSize = <D as OutputSizeUser>::OutputSize

Size of the output in bytes.
source§

fn output_size() -> usize

Return output size in bytes.
source§

impl<D: Digest + BlockSizeUser> Update for SimpleHmac<D>

source§

fn update(&mut self, data: &[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<D: Digest + BlockSizeUser> MacMarker for SimpleHmac<D>

Auto Trait Implementations§

§

impl<D> Freeze for SimpleHmac<D>

§

impl<D> RefUnwindSafe for SimpleHmac<D>

§

impl<D> Send for SimpleHmac<D>
where D: Send,

§

impl<D> Sync for SimpleHmac<D>
where D: Sync,

§

impl<D> Unpin for SimpleHmac<D>

§

impl<D> UnwindSafe for SimpleHmac<D>

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<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
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 new(key: &GenericArray<u8, <T as KeySizeUser>::KeySize>) -> T
where T: KeyInit,

Create new value from fixed size key.
source§

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

Create new value from variable size key.
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: &GenericArray<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: &GenericArray<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.