Vital.sandbox
Crypto

crypto.hash

Shared

Retrieves computed cryptographic hash of a string


Syntax

local hash = crypto.hash(mode, input)

Parameters

TypeNameDescription
stringmodeHash mode:
"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
stringinputString containing data to be hashed

Returns

TypeNameDescription
string / boolhashComputed hash on successful execution, or false on failure

Examples

local input = "Hello World"

engine.print("Input:", input)
engine.print("Hash:", crypto.hash("SHA256", input))

On this page