Syntax
crypt.decrypt(data: string, key: string, iv: string, mode?: "CBC" | "ECB" | "CTR"): stringArguments
| Name | Type | Description |
|---|---|---|
data | string | Input byte string or text processed by the function. |
key | string | Cryptographic key used by the operation. |
iv | string | Initialization vector used by the cipher. Provide it for decrypting existing data. |
mode? | "CBC" | "ECB" | "CTR" | AES mode. Defaults to CBC. |
Returns
| Name | Type | Description |
|---|---|---|
plaintext | string | Decrypted plain text. |
Description
Decrypts ciphertext with the provided key, initialization vector, and optional cipher mode.
Call it with 4 parameter(s): data, key, iv, mode. The argument table explains which values are required and which ones only refine the behavior.
It returns plaintext (string). Use the returns table to separate successful values from nil results and recoverable errors.
Example
Example call with placeholder values.
local result = crypt.decrypt("example", "example", "example", nil)
print(result)