M MY Multiplayer: Wiki
Side
Kind

hash

Shared

Hashes a text: MD5, SHA-1, SHA-2 or an HMAC.

string|false hash(string algorithm, string data [, table options = nil])

Parameters

NameTypeDescription
algorithmstring"md5", "sha1", "sha224", "sha256", "sha384", "sha512" or "hmac".
datastringThe text.
optionstableOnly for "hmac": key (the key) and algorithm (one of the other algorithms).default nil

Returns

The hash in lowercase hex, or false if the HMAC options are invalid.

Example

local digest = hash("sha256", "hello")
local signature = hash("hmac", "payload", { key = "secret", algorithm = "sha256" })

See also