M MY Multiplayer: Wiki
Lado
Tipo

hash

Compartilhado

Calcula o hash de um texto: MD5, SHA-1, SHA-2 ou um HMAC.

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

Parâmetros

NomeTipoDescrição
algorithmstring"md5", "sha1", "sha224", "sha256", "sha384", "sha512" ou "hmac".
datastringO texto.
optionstableSó para "hmac": key (a chave) e algorithm (um dos outros algoritmos).padrão nil

Retorno

O hash em hexadecimal minúsculo, ou false se as opções do HMAC são inválidas.

Exemplo

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

Veja também