aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/factor.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-03 02:02:48 +0000
committerlloyd <[email protected]>2010-03-03 02:02:48 +0000
commit82ab6d27cc2b434b4b7ffa528396d67fe6993222 (patch)
tree6be9207091acf15df1936ab072a2562c7f111ff9 /doc/examples/factor.cpp
parenta0d6ce4ce5ccb0108cdd155c7abd830432dc6991 (diff)
Fix minor errors and warnings in the examples. Remove boost dependency from
rng_test example.
Diffstat (limited to 'doc/examples/factor.cpp')
-rw-r--r--doc/examples/factor.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/doc/examples/factor.cpp b/doc/examples/factor.cpp
index 7700d9b2d..b0105426b 100644
--- a/doc/examples/factor.cpp
+++ b/doc/examples/factor.cpp
@@ -17,11 +17,14 @@ using namespace Botan;
#include <iostream>
#include <memory>
-// Pollard's Rho algorithm, as described in the MIT algorithms book
-// We use (x^2+x) mod n instead of (x*2-1) mod n as the random function,
-// it _seems_ to lead to faster factorization for the values I tried.
+namespace {
+/*
+* Pollard's Rho algorithm, as described in the MIT algorithms book. We
+* use (x^2+x) mod n instead of (x*2-1) mod n as the random function,
+* it _seems_ to lead to faster factorization for the values I tried.
+*/
BigInt rho(const BigInt& n, RandomNumberGenerator& rng)
{
BigInt x = BigInt::random_integer(rng, 0, n-1);
@@ -117,6 +120,8 @@ std::vector<BigInt> factorize(const BigInt& n_in,
return factors;
}
+}
+
int main(int argc, char* argv[])
{
if(argc != 2)