rok::core::crypto::hmac
HMAC (RFC 2104) and HKDF (RFC 5869) over a SHA-2 function.
Structs
Hmac
pub struct HmacA running HMAC. A value: copying it forks the running MAC.
pub fn new(alg: HashAlgorithm, key: Bytes) -> Hmacpub fn mac(alg: HashAlgorithm, key: Bytes, data: Bytes) -> List<u8>The tag of
dataunderkey.pub fn verify(alg: HashAlgorithm, key: Bytes, data: Bytes, tag: Bytes) -> boolWhether
tagis the tag ofdata, compared in constant time.pub fn update(ref self, data: Bytes)pub const fn finish(self) -> List<u8>
Hkdf
pub struct HkdfHKDF: extract a pseudorandom key, expand it into output keying
material.
pub fn extract(alg: HashAlgorithm, salt: Bytes, ikm: Bytes) -> SecretHMAC(salt, ikm); an empty salt isoutput_lenzero bytes.pub fn expand(alg: HashAlgorithm, prk: Bytes, info: Bytes, len: usize) throws (ValueError) -> Secretlenbytes of output keying material;lenis at most255 * output_len.