#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum MacHash {
Sha2_256,
Sha2_384,
Sha2_512,
}
impl core::fmt::Display for MacHash {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let detail = match self {
MacHash::Sha2_256 => "SHA-256",
MacHash::Sha2_384 => "SHA-384",
MacHash::Sha2_512 => "SHA-512",
};
write!(f, "{detail}")
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[non_exhaustive]
pub enum MacFailureKind {
InvalidKeyLength,
InvalidTagLength,
VerificationFailed,
BackendFailure,
}
impl core::fmt::Display for MacFailureKind {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let detail = match self {
MacFailureKind::InvalidKeyLength => "invalid key length",
MacFailureKind::InvalidTagLength => "invalid tag length",
MacFailureKind::VerificationFailed => "verification failed",
MacFailureKind::BackendFailure => "backend failure",
};
write!(f, "{detail}")
}
}