Vital.sandbox
Crypto

crypto.decrypt

Shared

Decodes a cryptographically encrypted string


Syntax

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

Parameters

TypeNameDescription
stringmodeDecryption mode:
"AES128" - Advanced Encryption Standard 128-bit
"AES192" - Advanced Encryption Standard 192-bit
"AES256" - Advanced Encryption Standard 256-bit
stringinputEncrypted string to be decrypted
stringkeyKey to be used for decryption
stringivGenerated initialization vector

Returns

TypeNameDescription
string / boolresultDecrypted string on successful execution, or false on failure

Examples

local key = "MySecretKey12345"
local input, iv = crypto.encrypt("AES256", "Hello World", key)

engine.print("Input:", input)
engine.print("Decrypted:", crypto.decrypt("AES256", input, key, iv))

On this page