lua-users home
lua-l archive

Re: Difference between a+b and bit32.band(a+b)

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


> On Mon, Sep 12, 2011 at 4:55 PM, Roberto Ierusalimschy
> <roberto@inf.puc-rio.br> wrote:
> > After too many cycles,
> > the accumulation of overflows ends up causing problems (e.g., loosing
> > bits).
> 
> True. By my calculation, you can safely add about a million 32-bit
> integers together before you risk losing bits in the worst-case
> scenario.
Yes. But in the SHA algorithm, we end up summing some Hs with other Hs,
not with 32-bit integers. So, at each step we may get a whole extra
bit in the result; after a few dozen iterations we already may have
problems.
-- Roberto

AltStyle によって変換されたページ (->オリジナル) /