Volt

crypt.decrypt

Decrypts data using a specified algorithm and key.

Syntax

crypt.decrypt(data: string, key: string, iv: string?, algorithm: string?) -> string

Parameters

ParameterTypeDescription
datastringThe encrypted data
keystringThe decryption key
ivstring(Optional) Initialization vector
algorithmstring(Optional) Algorithm, defaults to "AES-CBC"

Returns

TypeDescription
stringThe decrypted data

Description

crypt.decrypt decrypts data that was encrypted with crypt.encrypt using the same algorithm and key.

Example

local key = crypt.generatekey()
local original = "Hello, World!"

-- Encrypt and decrypt
local encrypted = crypt.encrypt(original, key)
local decrypted = crypt.decrypt(encrypted, key)

print(decrypted) -- "Hello, World!"

On this page