lua-users home
lua-l archive

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


On Fri, Sep 9, 2011 at 1:55 PM, waspoza <waspoza@gmail.com> wrote:
> Hi,
>
> I'm a fresh lua user and i stumbled upon a interesting thing in sha256
> algorithm from page: http://lua-users.org/wiki/SecureHashAlgorithm
>
> In digestblock function there is a line: H[1] = band(H[1] + a).
>
> Why addition result is being passed to binary and funcion? In same
> function there are other additions without 'and', so i dont really
> understand whats the point of it.
>
> TIA.
>
>

I'm not sure about this, but I've heard of people doing similar things
in JavaScript to force the native Number type to a 32-bit integer,
taking overflow into account correctly, etc.

-Duncan