Skip to main content

HMAC

Struct HMAC 

Source
pub struct HMAC<const BLOCK_SIZE: usize, const OUTPUT_SIZE: usize, T: HashDigest<BLOCK_SIZE, OUTPUT_SIZE>> { /* private fields */ }
Expand description

Implementation of RFC 2104 based on the Wikipedia algorithm

THIS SHOULD NOT BE USED FOR ANYTHING SECURITY RELATED

Implementations§

Source§

impl<const BLOCK_SIZE: usize, const OUTPUT_SIZE: usize, T: HashDigest<BLOCK_SIZE, OUTPUT_SIZE>> HMAC<BLOCK_SIZE, OUTPUT_SIZE, T>

Source

pub fn new(in_key: &[u8]) -> Self

Creates a new HMAC, initialized with the provided key

Source

pub fn write(&mut self, bytes: &[u8])

Source

pub fn hash(self, bytes: &[u8]) -> [u8; OUTPUT_SIZE]

Hashes the provided bytes.

Source

pub fn finish(self) -> [u8; OUTPUT_SIZE]

Finishes the hash and returns the result.

Auto Trait Implementations§

§

impl<const BLOCK_SIZE: usize, const OUTPUT_SIZE: usize, T> Freeze for HMAC<BLOCK_SIZE, OUTPUT_SIZE, T>
where T: Freeze,

§

impl<const BLOCK_SIZE: usize, const OUTPUT_SIZE: usize, T> RefUnwindSafe for HMAC<BLOCK_SIZE, OUTPUT_SIZE, T>
where T: RefUnwindSafe,

§

impl<const BLOCK_SIZE: usize, const OUTPUT_SIZE: usize, T> Send for HMAC<BLOCK_SIZE, OUTPUT_SIZE, T>
where T: Send,

§

impl<const BLOCK_SIZE: usize, const OUTPUT_SIZE: usize, T> Sync for HMAC<BLOCK_SIZE, OUTPUT_SIZE, T>
where T: Sync,

§

impl<const BLOCK_SIZE: usize, const OUTPUT_SIZE: usize, T> Unpin for HMAC<BLOCK_SIZE, OUTPUT_SIZE, T>
where T: Unpin,

§

impl<const BLOCK_SIZE: usize, const OUTPUT_SIZE: usize, T> UnwindSafe for HMAC<BLOCK_SIZE, OUTPUT_SIZE, T>
where T: 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<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, U> MaybeInto<U> for T
where U: MaybeFrom<T>,

Source§

fn maybe_into(self) -> Option<U>

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.