tuweni / org.apache.tuweni.crypto.sodium / HMACSHA512256

HMACSHA512256

class HMACSHA512256 (source)

Message authentication code support for HMAC-SHA-512-256.

HMAC-SHA-512-256 is implemented as HMAC-SHA-512 with the output truncated to 256 bits. This is slightly faster than HMAC-SHA-256. Note that this construction is not the same as HMAC-SHA-512/256, which is HMAC using the SHA-512/256 function.

Types

Key

class Key : Destroyable

A HMACSHA512256 secret key.

Functions

authenticate

static fun authenticate(message: Bytes, key: Key): Bytes
static fun authenticate(message: ByteArray, key: Key): ByteArray

Authenticates a message using a secret into a HMAC-SHA-512-256 authenticator.

verify

static fun verify(authenticator: Bytes, in: Bytes, key: Key): Boolean
static fun verify(authenticator: ByteArray, in: ByteArray, key: Key): Boolean

Verifies the authenticator of a message matches according to a secret.