Hmac

Struct Hmac 

Source
pub struct Hmac<D>
where D: EagerHash,
{ /* private fields */ }
Expand description

Generic HMAC instance.

Trait Implementations§

Source§

impl<D> AlgorithmName for Hmac<D>

Source§

fn write_alg_name(f: &mut Formatter<'_>) -> Result<(), Error>

Write algorithm name into f.
Source§

impl<D> BlockSizeUser for Hmac<D>
where D: EagerHash,

Source§

type BlockSize = <HmacCore<D> as BlockSizeUser>::BlockSize

Size of the block in bytes.
Source§

fn block_size() -> usize

Return block size in bytes.
Source§

impl<D> Clone for Hmac<D>
where D: EagerHash,

Source§

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

Returns a duplicate 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> CoreProxy for Hmac<D>
where D: EagerHash,

Source§

type Core = HmacCore<D>

Core block-level type.
Source§

fn compose( core: <Hmac<D> as CoreProxy>::Core, buffer: BlockBuffer<<<Hmac<D> as CoreProxy>::Core as BlockSizeUser>::BlockSize, <<Hmac<D> as CoreProxy>::Core as BufferKindUser>::BufferKind>, ) -> Hmac<D>

Create Self from core and buffer.
Source§

fn decompose( self, ) -> (<Hmac<D> as CoreProxy>::Core, BlockBuffer<<<Hmac<D> as CoreProxy>::Core as BlockSizeUser>::BlockSize, <<Hmac<D> as CoreProxy>::Core as BufferKindUser>::BufferKind>)

Decompose self into core and buffer.
Source§

impl<D> Debug for Hmac<D>
where D: EagerHash,

Source§

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

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

impl<D> FixedOutput for Hmac<D>
where D: EagerHash,

Source§

fn finalize_into( self, out: &mut Array<u8, <Hmac<D> as OutputSizeUser>::OutputSize>, )

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<H> HmacImpl for Hmac<H>
where H: EagerHash,

Source§

fn new_from_slice(key: &[u8]) -> Hmac<H>

Create new HMAC state with the given key.
Source§

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

Update HMAC state.
Source§

fn finalize(self) -> Array<u8, <Hmac<H> as OutputSizeUser>::OutputSize>

Finalize the HMAC state and get generated tag.
Source§

impl<D> KeyInit for Hmac<D>
where D: EagerHash,

Source§

fn new(key: &Array<u8, <Hmac<D> as KeySizeUser>::KeySize>) -> Hmac<D>

Create new value from fixed size key.
Source§

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

Create new value from variable size key.
Source§

fn weak_key_test(_key: &Array<u8, Self::KeySize>) -> Result<(), WeakKeyError>

Check if the key might be considered weak.
Source§

fn new_checked(key: &Array<u8, Self::KeySize>) -> Result<Self, WeakKeyError>

Create new value from fixed size key after checking it for weakness.
Source§

impl<D> KeySizeUser for Hmac<D>
where D: EagerHash,

Source§

type KeySize = <HmacCore<D> as KeySizeUser>::KeySize

Key size in bytes.
Source§

fn key_size() -> usize

Return key size in bytes.
Source§

impl<D> OutputSizeUser for Hmac<D>
where D: EagerHash,

Source§

type OutputSize = <HmacCore<D> as OutputSizeUser>::OutputSize

Size of the output in bytes.
Source§

fn output_size() -> usize

Return output size in bytes.
Source§

impl<D> Update for Hmac<D>
where D: EagerHash,

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> MacMarker for Hmac<D>
where D: EagerHash,

Auto Trait Implementations§

§

impl<D> Freeze for Hmac<D>

§

impl<D> RefUnwindSafe for Hmac<D>

§

impl<D> Send for Hmac<D>
where <D as EagerHash>::Core: Send,

§

impl<D> Sync for Hmac<D>
where <D as EagerHash>::Core: Sync,

§

impl<D> Unpin for Hmac<D>

§

impl<D> UnwindSafe for Hmac<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§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 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

Source§

type Output = T

Should always be Self
Source§

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

Source§

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>,

Source§

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.