lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hello Gary, 

i've tried with the security.lua wrapper, same result:

require"security"
data="">
k = security.hash.engine('md5'):digest('abcd')
aes_cfb = security.crypto.engine('aes_cfb', k, k)
e=aes_cfb:encrypt(data.."a")
d=aes_cfb:decrypt(e)
assert(d==data.."a")

The result aes_cfb:encrypt is again an empty string.

On Mon, Jun 7, 2010 at 8:30 PM, gary ng <garyng2000@yahoo.com> wrote:
there is a simple wrapper security.lua in the distribution. you may cross check with that. I believe I have test cases against them and were ok at the time of writing.

function ex2()
key='abcdabcdabcdabcd'
data="">
iv=lxyssl.hash('md5'):digest(key)
e=lxyssl.aes(key):cfb_encrypt(data .. "a",iv)
d=lxyssl.aes(key):cfb_decrypt(e,iv)
assert(d==data .."a")
end