[Cryptography] Generating random values in a particular range

dj at deadhat.com dj at deadhat.com
Sun Aug 7 15:37:48 EDT 2016


> On Fri, Aug 5, 2016 at 11:59 PM, Sidney Markowitz <sidney at sidney.com>
> wrote:

>> Later versions of GMP have the improvement of iterating a maximum number
>> of
>> times then return the value mod n if it doesn't get a result less than n
>> by
>> then, but that improvement does not appear in the patent claims.
>
> That second method is known as rejection sampling and was invented by
> John von Neumann.
>>
>>

I note for no particular reason that re-hashing the last hash until you
get a number less than q, rather than adding 1 to the original value and
hashing is cheaper by the cost of one addition.




More information about the cryptography mailing list