Atomic docs

crypt.encrypt

crypt.encrypt(data: string, key: string, iv: string?, mode: string?): (string, string)

AES encryption. The key is base64 and the mode defaults to CBC. Returns the ciphertext and the IV, both base64; when no IV is given one is generated, which is why it comes back.

Example

lua
local key = crypt.generatekey()
local data, iv = crypt.encrypt("secret", key)
print(crypt.decrypt(data, key, iv)) --> secret
↑