Skip to content

Extremely simple single polynomial quadratic sieve in Python

Notifications You must be signed in to change notification settings

cramppet/quadratic-sieve

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

Extremely simple single polynomial quadratic sieve in Python

I set out to write an extremely simple, barebones implementation of the: https://en.wikipedia.org/wiki/Quadratic_sieve

Mainly for didactic purposes. I wanted to understand some asymptomatically good integer factorization algorithms and the quadratic sieve is far simpler than the faster alternative, the general number field sieve (GNFS).

This version of the quadratic sieve is single polynomial and uses Gaussian Elimination, meaning that it's runtime is far from optimal. Still, it should be better than trial divison for sufficiently larger integers.

The file QS.py is the implementation of the quadratic sieve, you can run it simply by invoking:

python QS.py <number>

Theoretically, it can handle numbers of arbitrary size, but the largest I tried with this implementation was about 10^30, which is small in comparision to what most implementations support and this took a good 30 min to factor.

About

Extremely simple single polynomial quadratic sieve in Python

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages