hyperledger-labs / agora-glass_pumpkin

agora-glass_pumpkin
https://wiki.hyperledger.org/display/labs/Agora
Apache License 2.0
21 stars 11 forks source link

Safe prime size is occasionally off by a few bits #12

Closed robinhundt closed 3 years ago

robinhundt commented 3 years ago

When generating safe primes with a specific size via safe_prime::new, the resulting Integer sometimes has a size which is off by one or two bits.

Related: https://github.com/mikelodder7/unknown_order/issues/4

mikelodder7 commented 3 years ago

I see. I'll investigate to see what is the cause.

STashakkori commented 3 years ago

If you set it to generate a prime of length 128 bits, it generates a number with 39 digits approximately 3/4 of the time and a number with 38 digits 1/4 of the time.

mikelodder7 commented 3 years ago

Fixed in bce0b60ae0ac60caa1cd74aaeb7c4f84739e6f1d