util.crypto.decrypt
Shared
Decodes a cryptographically encrypted string
Syntax
local result = util.crypto.decrypt(
mode,
input,
key,
iv
)Parameters
| Type | Name | Description |
|---|---|---|
string | mode | Encryption mode Refer Modes section |
string | input | Encrypted string to decrypt |
string | key | Key to use for decryption |
string | iv | Generated initialization vector |
Returns
| Type | Name | Description |
|---|---|---|
string | bool | result | Decrypted string on successful execution, false otherwise |
Modes
| Mode | Description |
|---|---|
"aes128" | Advanced Encryption Standard 128-bit |
"aes192" | Advanced Encryption Standard 192-bit |
"aes256" | Advanced Encryption Standard 256-bit |
Examples
local key = "MySecretKey12345"
local input, iv = util.crypto.encrypt("aes256", "Hello World", key)
core.engine.print("info", "Input:", input)
core.engine.print("info", "Decrypted:", util.crypto.decrypt("aes256", input, key, iv))