Pollard's p - 1 algorithm for factorization
Written in rust, using pyo3 to provide python bindings and primesieve for fast prime enumeration. libprimesieve.so
and primesieve.hpp
are required for compilation and running, and assumed to be present on the machine.
The pm1
function provides a factorization with a slightly unusual interface, see below, and pm1base
is the same thing, but where you can specify the base a
of the exponentiation pow(a, M, n)
. Additionally pm1_factorbase
allows you to specify a a custom factor base for the algorithm, rather than the default choice of primes below 2^n
.
The interface provided by pm1
and pm1base
will compute pm1_factorbase
approach. The classical extension of a second bound between under which only a single prime factor can be tolerated is currently not implemented.
A rust-driven CLI tool is provided that can perform the pm1base
functionality. If you want to compile the CLI only, without python bindings being involved, use the --no-default-features
flag for cargo.