1#![no_std]
13#![doc = include_str!("../README.md")]
14#![doc(
15 html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/26acc39f/logo.svg",
16 html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/26acc39f/logo.svg"
17)]
18#![cfg_attr(docsrs, feature(doc_cfg))]
19
20pub use digest::{self, KeyInit, Mac, block_api::EagerHash};
21
22pub mod block_api;
24mod simple;
25mod simple_reset;
26mod utils;
27
28pub use simple::SimpleHmac;
29pub use simple_reset::SimpleHmacReset;
30
31use core::fmt;
32use digest::block_api::{AlgorithmName, CoreProxy};
33
34digest::buffer_fixed!(
35 #[derive(Clone)]
37 pub struct Hmac<D: EagerHash>(block_api::HmacCore<D>);
38 impl: MacTraits KeyInit;
39);
40
41impl<D: EagerHash + AlgorithmName> AlgorithmName for Hmac<D> {
42 fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result {
43 <Self as CoreProxy>::Core::write_alg_name(f)
44 }
45}
46
47digest::buffer_fixed!(
48 #[derive(Clone)]
50 pub struct HmacReset<D: EagerHash>(block_api::HmacResetCore<D>);
51 impl: ResetMacTraits KeyInit;
52);
53
54impl<D: EagerHash + AlgorithmName> AlgorithmName for HmacReset<D> {
55 fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result {
56 <Self as CoreProxy>::Core::write_alg_name(f)
57 }
58}