lua-users home
lua-l archive

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


On Sat, Sep 10, 2011 at 2:33 AM, Petite Abeille
<petite.abeille@gmail.com> wrote:
>>  while true do
>>    b = file:read(2^12)
>>    if not b then break end
>>    x:add(b)
>>  end
>>
>> Its uglier, but gives correct checksums.
>
> If you prefer the for loop try something along these lines:
>
> for b in function() return file:read( 2^12 ) end do
>  x:add( b )
> end

Thats look nice, thanks! :)


BTW, if anyone here can modify lua-users wiki pages, maybe its good
idea to fix this page: http://lua-users.org/wiki/SecureHashAlgorithm
and replace io.lines with read.