package core:crypto/kmac

⌘K
Ctrl+K
or
/

    Overview

    package kmac implements the KMAC MAC algorithm.

    See: https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-185.pdf

    Index

    Types (1)
    Variables (0)

    This section is empty.

    Procedure Groups (0)

    This section is empty.

    Types

    Context ¶

    Context :: struct {
    	st:             struct #raw_union {
    		b: [200]u8,
    		q: [25]u64,
    	},
    	pt:             int,
    	rsiz:           int,
    	mdlen:          int,
    	dsbyte:         u8,
    	is_initialized: bool,
    	is_finalized:   bool,
    }
     

    Context is a KMAC instance.

    Related Procedures With Parameters

    Constants

    MIN_KEY_SIZE_128 ¶

    MIN_KEY_SIZE_128 :: 128 / 8
     

    MIN_KEY_SIZE_128 is the minimum key size for KMAC128 in bytes.

    MIN_KEY_SIZE_256 ¶

    MIN_KEY_SIZE_256 :: 256 / 8
     

    MIN_KEY_SIZE_256 is the minimum key size for KMAC256 in bytes.

    MIN_TAG_SIZE ¶

    MIN_TAG_SIZE :: 32 / 8
     

    MIN_TAG_SIZE is the absolute minimum tag size for KMAC in bytes (8.4.2). Most callers SHOULD use at least 128-bits if not 256-bits for the tag size.

    Variables

    This section is empty.

    Procedures

    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. This routine will panic if the dst length is less than MIN_TAG_SIZE.

    init_128 ¶

    init_128 :: proc(ctx: ^Context, key, domain_sep: []u8) {…}
     

    init_128 initializes a Context for KMAC28. This routine will panic if the key length is less than MIN_KEY_SIZE_128.

    init_256 ¶

    init_256 :: proc(ctx: ^Context, key, domain_sep: []u8) {…}
     

    init_256 initializes a Context for KMAC256. This routine will panic if the key length is less than MIN_KEY_SIZE_256.

    reset ¶

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

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

    sum ¶

    sum :: proc(sec_strength: int, dst, msg, key, domain_sep: []u8) {…}
     

    sum will compute the KMAC with the specified security strength, key, and domain separator over msg, and write the computed digest to dst.

    update ¶

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

    update adds more data to the Context.

    verify ¶

    verify :: proc(
    	sec_strength:              int, 
    	tag, msg, key, domain_sep: []u8, 
    	allocator := context.temp_allocator, 
    ) -> bool {…}
     

    verify will verify the KMAC tag computed with the specified security strength, key and domain separator over msg and return true iff the tag is valid.

    Procedure Groups

    This section is empty.

    Source Files

    Generation Information

    Generated with odin version dev-2024-04 (vendor "odin") Windows_amd64 @ 2024-04-26 21:08:58.353813900 +0000 UTC