INNER CODE UNIT · Rust
truncate
matrix-org/vodozemac · src/cipher/mod.rs:50
pub fn truncate(&self) -> [u8; Self::TRUNCATED_LEN] {
let mut truncated = [0u8; Self::TRUNCATED_LEN];
truncated.copy_from_slice(&self.0[0..Self::TRUNCATED_LEN]);
truncated
}
/// Return the [`Mac`] as a byte slice.
#[allow(unreachable_pub)]
pub fn as_bytes(&self) -> &[u8] {
self.0.as_ref()
}
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum MessageMac {
Truncated([u8; Mac::TRUNCATED_LEN]),
Full(Mac),