util.crypto.hash

Shared

Retrieves computed cryptographic hash of a string


Syntax

local hash = util.crypto.hash(
    mode,
    input
)

Parameters

TypeNameDescription
stringmodeHash mode
Refer Modes section
stringinputString containing data to hash

Returns

TypeNameDescription
string | boolhashComputed hash on successful execution, false otherwise

Modes

ModeDescription
"sha1"Secure Hash Algorithm 1
"sha224"Secure Hash Algorithm 224-bit
"sha256"Secure Hash Algorithm 256-bit
"sha384"Secure Hash Algorithm 384-bit
"sha512"Secure Hash Algorithm 512-bit

Examples

Hashes an input string
local input = "Hello World"

core.engine.print("info", "Input:", input)
core.engine.print("info", "Hash:", util.crypto.hash("sha256", input))

On this page