std1.0.0-beta-7 SafeC docs

std :: crypto::hmac

Struct std::Hmac

#include <std/crypto/hmac.h> source

generic<H: BlockHash> struct Hmac {
    H inner;
    H outer;
}

Fields

§H innersource

H((key ^ ipad) || message ...)

§H outersource

H((key ^ opad) || ...), fed the inner digest by finish()

Methods

§static struct Hmac<H> new(H fresh, []const unsigned char key)source · definition

An HMAC keyed by 'key' over 'fresh', a new context of the hash to use (Sha256Ctx::new(), Sha512Ctx::new_384(), ...). A key longer than the hash's block is hashed first, as RFC 2104 specifies.

§void update([]const unsigned char data)source · definition
§void finish([]unsigned char mac)source · definition

Writes the digest_size()-byte MAC into mac (a shorter slice panics). The context is spent after.

§unsigned long digest_size() constsource · definition