aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <lloyd@randombit.net>2010-03-05 06:29:14 +0000
committerlloyd <lloyd@randombit.net>2010-03-05 06:29:14 +0000
commitd4ef447dc8b3b4f40f2ab250b1c364e2f74ccfa4 (patch)
treec9a78f2e4c223a9b548e2f3b20cbad9e1642b10c
parent1eddb5edfc84af976d80af9a5cc785f809ebd253 (diff)
Force high bit in random_prime as well (done by randomize currently, but might not be later)
-rw-r--r--src/math/numbertheory/make_prm.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/math/numbertheory/make_prm.cpp b/src/math/numbertheory/make_prm.cpp
index b136b6d25..61d42634a 100644
--- a/src/math/numbertheory/make_prm.cpp
+++ b/src/math/numbertheory/make_prm.cpp
@@ -38,6 +38,9 @@ BigInt random_prime(RandomNumberGenerator& rng,
while(true)
{
BigInt p(rng, bits);
+
+ // Force lowest and two top bits on
+ p.set_bit(bits - 1);
p.set_bit(bits - 2);
p.set_bit(0);