Skip to content
Saiko

crypt.hmac

Returns the HMAC of a string under a secret key, base64 encoded.

Signature

luau
crypt.hmac(key: string, data: string, algorithm: string): string

Parameters

keystring

The secret key, as plain text.

datastring

The text to authenticate.

algorithmstring

The hash the HMAC is built on, for example "sha256".

Returns

string

Note

Example

luau
print(crypt.hmac("secret_key", "MYRIAD", "sha256")) --> FaDPiTSLlbxRP5rKvomt0dzwl7zhszc46/QFPsZRGWY=