crypt.hmac

Computes a keyed message digest.

Syntax

Signature
crypt.hmac(Key: string, Data: string, Algorithm: string?) -> string

Aliases

This function has no aliases.

Parameters

ParameterTypeDescription
KeystringRaw HMAC key, up to 16 MiB.
DatastringMessage bytes, up to 16 MiB.
Algorithmstring?Hash algorithm. Defaults to sha256.

Returns

TypeDescription
stringBase64-encoded HMAC digest.

Notes

Algorithm defaults to sha256 and accepts the same names as crypt.hash.

Example

Luau
local Result = crypt.hmac("key", "hello")
print(Result)