crypt.hmac
Computes a keyed digest and returns Base64 text.
Syntax
crypt.hmac(key: string, data: string, algorithm: string) -> string
Parameters
| Parameter | Type | Description |
|---|---|---|
key | string | Raw authentication-key bytes. |
data | string | Message bytes. |
algorithm | string | Supported digest name, for example sha256. |
Returns
| Type | Description |
|---|---|
string | Base64-encoded HMAC. |
Description
The key is a raw byte string, unlike the Base64 key parameter of crypt.encrypt. Use the same key, input bytes and algorithm when checking another result. This authenticates data; it does not hide the message.
Example
local key = crypt.random(32)
print(crypt.hmac(key, "hello", "sha256"))
These are Game executor contracts. Check build requirements and session lifetimes before using them.
