aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/factor.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move rng.{cpp,h} from core to rng/ topdirlloyd2008-10-261-3/+2
| | | | | | | | | | | | | | Add a new class AutoSeeded_RNG that is a RandomNumberGenerator that wraps up the logic formerly in RandomNumberGenerator::make_rng. make_rng in fact now just returns a new AutoSeeded_RNG object. AutoSeeded_RNG is a bit more convenient because - No need to use auto_ptr - No need to dereference (same syntax everywhere - it's an underestimated advantage imo) Also move the code from timer/timer_base to timer/
* Update examples for recent API changeslloyd2008-10-081-1/+1
|
* Fix the DSA examples. Reindent.lloyd2008-06-281-1/+2
|
* Update some of the examples for the recent API changeslloyd2008-06-271-8/+11
|
* Avoid using the global RNG in check_key, instead pass a reference.lloyd2008-05-241-2/+3
| | | | Update the examples
* If the LibraryInitializer is created with just default arguments, don'tlloyd2007-10-071-2/+0
| | | | | | | bother creating it, just let it be initialized lazily when needed. Reindents in encypt.cpp and hash_fd.cpp (indenting the brace after a try statement).
* Don't bail out of the rho computation until 2^32 tries, since thelloyd2006-07-161-3/+3
| | | | | | 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.
* Have to (potentially) factor the result from the Rho computation, as itlloyd2006-07-161-4/+7
| | | | might be composite.
* Move the declaration of a_factor outside the loop, and use a do looplloyd2006-07-161-4/+5
| | | | | instead of a while loop so it doesn't have to be initialized each time through.
* Remove some completely redundant code in factorize()lloyd2006-07-161-6/+1
|
* Break out after 2^16 tries, so we restart from a different random pointlloyd2006-07-161-4/+8
| | | | | | | | if we don't find a cycle fairly quickly. Use (x^2 + x) % n instead of (x^2 - 1) % n; it seems to be giving better (ie, faster) results, though to be honest I'm not sure exactly why this should be the case.
* Make factorize() iterative instead of recursive lloyd2006-07-161-22/+50
|
* Remove whitespace, add a slightly informative comment, etclloyd2006-07-161-2/+2
|
* Remove a debugging print statementlloyd2006-07-161-4/+3
| | | | | Change the output to sort the factors, and use ':' instead of '=' so the output exactly matches that of the BSD 'factor' program.
* Add an example that performs factoring (using Pollard's Rho algorithm)lloyd2006-07-161-0/+110