crypto::hmac

Struct Hmac

Source
pub struct Hmac<D> { /* private fields */ }
Expand description

The Hmac struct represents an Hmac function - a Message Authentication Code using a Digest.

Implementations§

Source§

impl<D: Digest> Hmac<D>

Source

pub fn new(digest: D, key: &[u8]) -> Hmac<D>

Create a new Hmac instance.

§Arguments
  • digest - The Digest to use.
  • key - The key to use.

Trait Implementations§

Source§

impl<D: Digest> Mac for Hmac<D>

Source§

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

Process input data. Read more
Source§

fn reset(&mut self)

Reset the Mac state to begin processing another input stream.
Source§

fn result(&mut self) -> MacResult

Obtain the result of a Mac computation as a MacResult.
Source§

fn raw_result(&mut self, output: &mut [u8])

Obtain the result of a Mac computation as u8. This method should be used very carefully since incorrect use of the Mac code could result in permitting a timing attack which defeats the security provided by a Mac function.
Source§

fn output_bytes(&self) -> usize

Get the size of the Mac code, in bytes.

Auto Trait Implementations§

§

impl<D> Freeze for Hmac<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for Hmac<D>
where D: RefUnwindSafe,

§

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

§

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

§

impl<D> Unpin for Hmac<D>
where D: Unpin,

§

impl<D> UnwindSafe for Hmac<D>
where D: 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> 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.