aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-07-16 20:29:33 +0000
committerlloyd <[email protected]>2006-07-16 20:29:33 +0000
commit0460495e50590f274e0c686bce5074f1d57bf93d (patch)
tree772d7047a4677ea40c541a04b32b48813b708473 /doc
parent311b29d8115df01b4a7aa3d1207af3ae67afa7d1 (diff)
Don't bail out of the rho computation until 2^32 tries, since the
cycle size is based on the square root of the prime factors, bailing after 2^16 would mean we would be unlikely to find any factors larger than 32 bits.
Diffstat (limited to 'doc')
-rw-r--r--doc/examples/factor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/doc/examples/factor.cpp b/doc/examples/factor.cpp
index 163d83fe0..bdd6319b7 100644
--- a/doc/examples/factor.cpp
+++ b/doc/examples/factor.cpp
@@ -28,15 +28,15 @@ BigInt rho(const BigInt& n)
{
i++;
+ if(i == 0) // overflow, bail out
+ break;
+
x = mod_n.multiply((x + 1), x);
d = gcd(y - x, n);
if(d != 1 && d != n)
return d;
- if(i == 65536) // bail
- break;
-
if(i == k)
{
y = x;