package core:crypto/hmac

⌘K
Ctrl+K
or
/

    Overview

    package hmac implements the HMAC MAC algorithm.

    See: https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.198-1.pdf

    Index

    Types (1)
    Constants (0)

    This section is empty.

    Variables (0)

    This section is empty.

    Procedure Groups (0)

    This section is empty.

    Types

    Context ¶

    Context :: struct {
    	_o_hash:         crypto_hash.Context,
    	// H(k ^ ipad) (not finalized)
    	_i_hash:         crypto_hash.Context,
    	// H(k ^ opad) (not finalized)
    	_tag_sz:         int,
    	_is_initialized: bool,
    }
     

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

    Related Procedures With Parameters

    Constants

    This section is empty.

    Variables

    This section is empty.

    Procedures

    algorithm ¶

    algorithm :: proc(ctx: ^Context) -> crypto_hash.Algorithm {…}
     

    algorithm returns the Algorithm used by a Context instance.

    clone ¶

    clone :: proc(ctx, other: ^Context) {…}
     

    clone clones the Context other into ctx.

    final ¶

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

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

    init ¶

    init :: proc(ctx: ^Context, algorithm: crypto_hash.Algorithm, key: []u8) {…}
     

    init initializes a Context with a specific hash Algorithm and key.

    reset ¶

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

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

    sum ¶

    sum :: proc(algorithm: crypto_hash.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 ¶

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

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

    update ¶

    update :: proc(ctx: ^Context, data: []u8) {…}
     

    update adds more data to the Context.

    verify ¶

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

    verify will verify the HMAC tag computed with the specified algorithm and key over msg and return true iff the tag is valid. It requires that the tag is correctly sized.

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2024-12 (vendor "odin") Windows_amd64 @ 2024-12-17 21:11:00.939633300 +0000 UTC