util.crypto.hash
Shared
Retrieves computed cryptographic hash of a string
Syntax
local hash = util.crypto.hash(
mode,
input
)Parameters
| Type | Name | Description |
|---|---|---|
string | mode | Hash mode Refer Modes section |
string | input | String containing data to hash |
Returns
| Type | Name | Description |
|---|---|---|
string | bool | hash | Computed hash on successful execution, false otherwise |
Modes
| Mode | Description |
|---|---|
"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
local input = "Hello World"
core.engine.print("info", "Input:", input)
core.engine.print("info", "Hash:", util.crypto.hash("sha256", input))