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