pub trait HmacVariant<const KEY_LENGTH: usize, const MAC_LENGTH: usize> {
type State;
type Mac: NewByteArray<MAC_LENGTH> + Zeroize;
// Required methods
fn compute(mac: &mut [u8; MAC_LENGTH], input: &[u8], key: &[u8; KEY_LENGTH]);
fn verify(
mac: &[u8; MAC_LENGTH],
input: &[u8],
key: &[u8; KEY_LENGTH],
) -> Result<(), Error>;
fn init(key: &[u8; KEY_LENGTH]) -> Self::State;
fn update(state: &mut Self::State, input: &[u8]);
fn finalize(state: Self::State, mac: &mut [u8; MAC_LENGTH]);
}Expand description
HMAC algorithm variant used by Hmac.
Required Associated Types§
Sourcetype Mac: NewByteArray<MAC_LENGTH> + Zeroize
type Mac: NewByteArray<MAC_LENGTH> + Zeroize
Default stack-allocated MAC type used by verification.
Required Methods§
Sourcefn compute(mac: &mut [u8; MAC_LENGTH], input: &[u8], key: &[u8; KEY_LENGTH])
fn compute(mac: &mut [u8; MAC_LENGTH], input: &[u8], key: &[u8; KEY_LENGTH])
Computes a MAC in one shot.
Sourcefn verify(
mac: &[u8; MAC_LENGTH],
input: &[u8],
key: &[u8; KEY_LENGTH],
) -> Result<(), Error>
fn verify( mac: &[u8; MAC_LENGTH], input: &[u8], key: &[u8; KEY_LENGTH], ) -> Result<(), Error>
Sourcefn init(key: &[u8; KEY_LENGTH]) -> Self::State
fn init(key: &[u8; KEY_LENGTH]) -> Self::State
Initializes incremental authentication.
Sourcefn finalize(state: Self::State, mac: &mut [u8; MAC_LENGTH])
fn finalize(state: Self::State, mac: &mut [u8; MAC_LENGTH])
Finalizes incremental authentication.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".