1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
use crate::Result; /// A message authentication code. /// /// A MAC is a symmetric signature primitive. pub trait Mac { /// Size of the MAC tag i.e. the signature in bytes. fn mac_size(&self) -> usize; /// Add data to be signed. fn update(&mut self, data: &[u8]); /// Produce the MAC tag `digest` for all data fed via `update()`. /// /// Returns `InvalidArgument` if digest is not `Self::mac_size`. fn digest(&mut self, digest: &mut [u8]) -> Result<()>; }