lua-users home
lua-l archive

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


Well:

Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> require"security"
> data="">
> k = security.hash.engine('md5'):digest('abcd')
> print(k)
??qLG'?$?.3
> aes_cfb = security.crypto.engine('aes_cfb', k, k)
> e=aes_cfb:encrypt(data.."a")
> print(e)

> print(#e)
0

I don't understand..

On Tue, Jun 8, 2010 at 12:16 AM, gary ng <garyng2000@yahoo.com> wrote:
Copy and paste code, interactively line by line to verify the length via #e which doesn't show the problem you mentioned.

From: Valerio Schiavoni <valerio.schiavoni@gmail.com>
To: Lua list <lua@bazar2.conectiva.com.br>
Sent: Mon, June 7, 2010 3:07:21 PM

Subject: Re: lxyssl (AES binding), CFB en

Hi,
just to be clear: are you saying that one of the 2 code snippets I've posted is working on your machine? 

Or, you're saying that you have some other variant of this same functionality that is working fine for you? If so, I'd be very curious to see it. 

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")

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