generate

fun generate(input: String, key: ByteArray = generateKey()): HmacSha256.Result

Generates an HMAC-SHA256 tag for an input string using the specified or generated key.

Return

A Result containing the HMAC tag and the key used.

Parameters

input

The input string to generate the HMAC for.

key

The key to use for HMAC computation (default: a newly generated key via generateKey).