package core:crypto/kmac
Overview
package kmac implements the KMAC MAC algorithm.
See: https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-185.pdf
Index
Types (1)
Constants (3)
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
final ¶
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 initializes a Context for KMAC28. This routine will panic if the key length is less than MIN_KEY_SIZE_128.
init_256 ¶
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 will compute the KMAC with the specified security strength, key, and domain separator over msg, and write the computed digest to dst.
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-11 (vendor "odin") Windows_amd64 @ 2024-11-16 21:10:09.816295500 +0000 UTC