Trait Mac
pub trait Mac: OutputSizeUser + Sized
Convenience wrapper trait covering functionality of Message Authentication algorithms.
This trait wraps Update, FixedOutput, and MacMarker traits
and provides additional convenience methods.
Required Methods
fn update(&mut self, data: &[u8])Update state using the provided data.
fn chain_update(self, data: impl AsRef<[u8]>) -> SelfProcess input data in a chained manner.
fn finalize(self) -> CtOutput<Self>Obtain the result of a
Maccomputation as aCtOutputand consumeMacinstance.fn finalize_reset(&mut self) -> CtOutput<Self> where Self: FixedOutputReset,Obtain the result of a
Maccomputation as aCtOutputand resetMacinstance.fn reset(&mut self) where Self: Reset,Reset MAC instance to its initial state.
fn verify(self, tag: &Output<Self>) -> Result<(), MacError>Check if tag/code value is correct for the processed input.
Errors
Returns
MacErroriftagis not valid.fn verify_reset(&mut self, tag: &Output<Self>) -> Result<(), MacError> where Self: FixedOutputReset,Check if tag/code value is correct for the processed input and reset
Macinstance.Errors
Returns
MacErroriftagis not valid.fn verify_slice(self, tag: &[u8]) -> Result<(), MacError>Check truncated tag correctness using all bytes of calculated tag.
Errors
Returns
MacErroriftagis not valid or not equal in length to this MAC's output.fn verify_slice_reset(&mut self, tag: &[u8]) -> Result<(), MacError> where Self: FixedOutputReset,Check truncated tag correctness using all bytes of calculated tag and reset
Macinstance.Errors
Returns
MacErroriftagis not valid or not equal in length to MAC's output.fn verify_truncated_left(self, tag: &[u8]) -> Result<(), MacError>Check truncated tag correctness using left side bytes (i.e.
tag[..n]) of calculated tag.Errors
Returns
Erroriftagis not valid or empty.fn verify_truncated_right(self, tag: &[u8]) -> Result<(), MacError>Check truncated tag correctness using right side bytes (i.e.
tag[n..]) of calculated tag.Errors
Returns
Erroriftagis not valid or empty.
Implementors
impl<T> Mac for XofFixedWrapper<T, S> where T: Update + FixedOutput + MacMarker,impl<T: Update + FixedOutput + MacMarker> Mac for T