-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathlib.rs
More file actions
60 lines (51 loc) · 1.76 KB
/
lib.rs
File metadata and controls
60 lines (51 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Overwrite intra-crate links
//! [`Reset`]: digest::Reset
//! [`Digest`]: digest::Digest
//! [`FixedOutputReset`]: digest::FixedOutputReset
//! [`Hmac`]: Hmac
//! [`HmacReset`]: HmacReset
//! [`SimpleHmac`]: SimpleHmac
//! [`SimpleHmacReset`]: SimpleHmacReset
//! [`block_api::HmacCore`]: block_api::HmacCore
//! [`block_api::HmacResetCore`]: block_api::HmacResetCore
#![no_std]
#![doc = include_str!("../README.md")]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/RustCrypto/media/26acc39f/logo.svg",
html_favicon_url = "https://raw.githubusercontent.com/RustCrypto/media/26acc39f/logo.svg"
)]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![forbid(unsafe_code)]
#![warn(missing_docs)]
pub use digest::{self, KeyInit, Mac, block_api::EagerHash};
/// Block-level implementation.
pub mod block_api;
mod simple;
mod simple_reset;
mod utils;
pub use simple::SimpleHmac;
pub use simple_reset::SimpleHmacReset;
use core::fmt;
use digest::block_api::{AlgorithmName, CoreProxy};
digest::buffer_fixed!(
/// Generic HMAC instance.
#[derive(Clone)]
pub struct Hmac<D: EagerHash>(block_api::HmacCore<D>);
impl: BaseFixedTraits MacMarker KeyInit;
);
impl<D: EagerHash + AlgorithmName> AlgorithmName for Hmac<D> {
fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result {
<Self as CoreProxy>::Core::write_alg_name(f)
}
}
digest::buffer_fixed!(
/// Generic HMAC instance with reset support.
#[derive(Clone)]
pub struct HmacReset<D: EagerHash>(block_api::HmacResetCore<D>);
impl: BaseFixedTraits MacMarker Reset FixedOutputReset KeyInit;
);
impl<D: EagerHash + AlgorithmName> AlgorithmName for HmacReset<D> {
fn write_alg_name(f: &mut fmt::Formatter<'_>) -> fmt::Result {
<Self as CoreProxy>::Core::write_alg_name(f)
}
}