Simple interface for password based AES-256 encryption and decryption using the lua-resty-nettle library.
local EasyCrypto = require "resty.easy-crypto"
local ecrypto = EasyCrypto:new({ -- Initialize with default values
saltSize = 12,
ivSize = 16, -- for CTR mode
iterationCount = 10000
})
-- local ecrypto = EasyCrypto:new() -- Same as above
local encrypted = ecrypto:encrypt("password", "plain text")
local decrypted = ecrypto:decrypt("password", encrypted)
assert(encrypted == decrypted)