AES encrypt library

Started by ckupen, Dec 08, 2022, 04:44 am

Previous topic - Next topic

ckupen

An API for AES encryption

Have stream encryption with Output feedback mode (OFB)

Link: <https://gist.github.com/zyxkad/a5e02d16d244b20b026ecfb06f662210>;

ckupen

Usage:

```lua
os.loadAPI('aes.lua')

key = string.rep('0', 16) -- A 16 bytes key, DO NOT use repeat bytes if you want safety
cipher = aes.Cipher:new(nil, key)
sec = cipher:encrypt("Hello world") -- data can be any length

data = cipher:decrypt(sec) -- Be careful, each decrypt must match a encrypt, you cannot jump off any data
print('data is:', data)

```