crypt.encrypt
Encrypts data using AES with the specified key and mode.
function crypt.encrypt(datadatastringPlaintext to encrypt.: string, keykeystringBase64-encoded 256-bit key.: string, ivivstring?Base64-encoded AES IV. Auto-generated if omitted.: string?, modemodestring?Cipher mode (default "CBC").: string?): (string, string)stringBase64-encoded ciphertext.stringBase64-encoded IV used.Usage
Encrypt / decrypt
local key = crypt.generatekey()
local ciphertext, iv = crypt.encrypt("secret data", key)
local plaintext = crypt.decrypt(ciphertext, key, iv)
print(plaintext) --> secret data