util.crypto.decrypt

Shared

Decodes a cryptographically encrypted string


Syntax

local result = util.crypto.decrypt(
    mode,
    input,
    key,
    iv
)

Parameters

TypeNameDescription
stringmodeEncryption mode
Refer Modes section
stringinputEncrypted string to decrypt
stringkeyKey to use for decryption
stringivGenerated initialization vector

Returns

TypeNameDescription
string | boolresultDecrypted string on successful execution, false otherwise

Modes

ModeDescription
"aes128"Advanced Encryption Standard 128-bit
"aes192"Advanced Encryption Standard 192-bit
"aes256"Advanced Encryption Standard 256-bit

Examples

Decrypts an input string
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))

On this page