bug-gnulib
[Top][All Lists]
Advanced

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

Re: gc-pbkdf2-sha1


From: Bruno Haible
Subject: Re: gc-pbkdf2-sha1
Date: Wed, 12 Oct 2005 18:54:49 +0200
User-agent: KMail/1.5

Simon Josefsson wrote:
> Perhaps for clarity we could change it into:
>
> #define CEIL_DIV(a,b) (((a) - 1) / (b)) + 1
>   l = CEIL_DIV (dkLen, hLen);
>
> What do you think?

People could be tempted to borrow this formula and apply to situations where
it doesn't fit.

Normally one uses
   #define CEIL(a,b) (((a) + (b) - 1) / (b))
but not here, because here
  - this formula could yield overflow,
  - it is known that dkLen > 0.

> Neither of the first two approaches is really trivial to understand
> what they mean

The comment already explains it:

               l = CEIL (dkLen / hLen) ,

But you are free to add more comments, of course.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]