pub struct Hmac<H: Hasher> { /* private fields */ }Expand description
HMAC (Hash-based Message Authentication Code) implementation.
Uses a generic hash function implementing the Hasher trait (e.g.
Sha256 or Sha512).
§One-shot API
ⓘ
use crypto::hmac::Hmac;
use crypto::sha2::Sha256;
let tag = Hmac::<Sha256>::mac(b"key", b"message");§Incremental API
ⓘ
use crypto::hmac::Hmac;
use crypto::sha2::Sha256;
let mut mac = Hmac::<Sha256>::new(b"key");
mac.update(b"hello ");
mac.update(b"world");
let tag = mac.finalize();Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<H> Freeze for Hmac<H>where
H: Freeze,
impl<H> RefUnwindSafe for Hmac<H>where
H: RefUnwindSafe,
impl<H> Send for Hmac<H>where
H: Send,
impl<H> Sync for Hmac<H>where
H: Sync,
impl<H> Unpin for Hmac<H>where
H: Unpin,
impl<H> UnsafeUnpin for Hmac<H>where
H: UnsafeUnpin,
impl<H> UnwindSafe for Hmac<H>where
H: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more