An API for AES encryption
Have stream encryption with Output feedback mode (OFB)
Link: <https://gist.github.com/zyxkad/a5e02d16d244b20b026ecfb06f662210>
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)
```
Quote from: ckupen on Dec 08, 2022, 04:49 AMUsage:
```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)
```
Looks cool! I would change two things tho (They're very simple), return a table and use
require()
, and maybe the gist link (If you click, appears broken at first).
(Basically os.loadAPI is deprecated) (https://tweaked.cc/module/os.html#v:loadAPI)
But with that tweaks, I'll probably use it on my server!
Nice work