`KMAC` message authentication code (`MAC`) algorithm. See: - [[ https://nvlpubs.nist.gov/nistpubs/specialpublications/nist.sp.800-185.pdf ]]

Collection Info

View Source
Collection
core
Path
crypto/kmac
Entries
12

Source Files

Constants

3

MIN_KEY_SIZE_128 #

Source
MIN_KEY_SIZE_128 :: 128 / 8

MIN_KEY_SIZE_128 is the minimum key size for KMAC128 in bytes.

MIN_KEY_SIZE_256 #

Source
MIN_KEY_SIZE_256 :: 256 / 8

MIN_KEY_SIZE_256 is the minimum key size for KMAC256 in bytes.

MIN_TAG_SIZE #

Source
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.

Types

1

Procedures

8

final #

Source
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 #

Source
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 #

Source
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 #

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

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

sum #

Source
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.

verify #

Source
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 if and only if (⟺) the tag is valid.