[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Difference between a+b and bit32.band(a+b)
- From: Roberto Ierusalimschy <roberto@...>
- Date: Mon, 12 Sep 2011 17:21:48 -0300
> 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