1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
7#[non_exhaustive]
8pub enum MacHash {
9 Sha2_256,
11 Sha2_384,
13 Sha2_512,
15}
16
17impl core::fmt::Display for MacHash {
18 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
19 let detail = match self {
20 MacHash::Sha2_256 => "SHA-256",
21 MacHash::Sha2_384 => "SHA-384",
22 MacHash::Sha2_512 => "SHA-512",
23 };
24 write!(f, "{detail}")
25 }
26}
27
28#[derive(Debug, Clone, Copy, PartialEq, Eq)]
30#[non_exhaustive]
31pub enum MacFailureKind {
32 InvalidKeyLength,
34 InvalidTagLength,
36 VerificationFailed,
38 BackendFailure,
40}
41
42impl core::fmt::Display for MacFailureKind {
43 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
44 let detail = match self {
45 MacFailureKind::InvalidKeyLength => "invalid key length",
46 MacFailureKind::InvalidTagLength => "invalid tag length",
47 MacFailureKind::VerificationFailed => "verification failed",
48 MacFailureKind::BackendFailure => "backend failure",
49 };
50 write!(f, "{detail}")
51 }
52}