`HMAC` message authentication code (`MAC`) algorithm. See: - [[ https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.198-1.pdf ]]

Collection Info

View Source
Collection
core
Path
crypto/hmac
Entries
10

Source Files

Types

1

Context #

Source
Context :: Context

Context is a concrete instantiation of HMAC with a specific hash algorithm.

Procedures

9

final #

Source
final :: proc(ctx: ^Context, dst: []u8) {…}

final finalizes the Context, writes the tag to dst, and calls reset on the Context.

reset #

Source
reset :: proc(ctx: ^Context) {…}

reset sanitizes the Context. The Context must be re-initialized to be used again.

sum #

Source
sum :: proc(algorithm: Algorithm, dst, msg, key: []u8) {…}

sum will compute the HMAC with the specified algorithm and key over msg, and write the computed tag to dst. It requires that the dst buffer is the tag size.

tag_size #

Source
tag_size :: proc(ctx: ^Context) -> int {…}

tag_size returns the tag size of a Context instance in bytes.

verify #

Source
verify :: proc(algorithm: Algorithm, tag, msg, key: []u8) -> bool {…}

verify will verify the HMAC tag computed with the specified algorithm and key over msg and return true if and only if (⟺) the tag is valid. It requires that the tag is correctly sized.