Usage:
os.loadAPI("aeslua") local iv = {} for i = 1, 16 do iv[i] = math.random(1, 255) end aeslua.encrypt("MyKey", "My Message", aealua.AES128, aeslua.CBCMODE, iv) aeslua.decrypt("MyKey", "My Encrypted Message", aealua.AES128, aeslua.CBCMODE, iv)
There are some more examples at the tests directory.
Stuff I've based this on: AES for Lua
Getting It:
Its on Github if you want to read all the code. You can fetch the raw file through wget or the HTTP API.
You can also use pastebin to download it: wget https://git.io/aeslua aeslua or pastebin run LYAxmSby get 86925e07cbabd70773e53d781bd8b2fe/aeslua.min.lua aeslua
Edit:
Unknown to me this has already been implemented before, by KleinRefrigerator and KillaVanilla. This implementation gives you access to 128, 192 and 265 bit versions and ECB, CBC, CFB, OFB and CTR modes and so is more flexible.
Edited by SquidDev, 15 March 2018 - 10:41 AM.