INNER CODE UNIT · Rust
mac
matrix-org/vodozemac · src/cipher/mod.rs:184
pub fn mac(&self, message: &[u8]) -> Mac {
let mut hmac = self.get_hmac();
hmac.update(message);
let mac_bytes = hmac.finalize().into_bytes();
let mut mac = [0u8; 32];
mac.copy_from_slice(&mac_bytes);
Mac(mac)
}
/// Decrypts the provided `ciphertext` using this [`Cipher`].
///
/// **Warning**: This is a low-level function. Before calling this, you must
/// call [`Cipher::verify_mac()`] or [`Cipher::verify_truncated_mac()`]
/// to ensure the integrity of the ciphertext.
#[allow(unreachable_pub)]