michel-leonard / c-quadratic-sieve Goto Github PK
View Code? Open in Web Editor NEWThe Quadratic Sieve algorithm for Integer Factorization up to 300+ bits in pure C.
The Quadratic Sieve algorithm for Integer Factorization up to 300+ bits in pure C.
steps to reproduce:
$ gcc main.c -O3 -o qs
In file included from main.c:2:
In function ‘cint_erase’,
inlined from ‘cint_right_shifti’ at cint.c:286:9,
inlined from ‘cint_sqrt.part.0’ at cint.c:536:4:
cint.c:107:34: warning: ‘memset’ specified size between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
107 | num->nat = 1, num->end = memset(num->mem, 0, (num->end - num->mem) * sizeof(h_cint_t));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘cint_right_shifti’,
inlined from ‘cint_sqrt.part.0’ at cint.c:536:4:
cint.c:278:31: note: destination object allocated here
278 | if (num->end - a > num->mem) {
| ~~~^~~~~
In function ‘cint_erase’,
inlined from ‘cint_right_shifti’ at cint.c:286:9,
inlined from ‘cint_sqrt.part.0’ at cint.c:539:4:
cint.c:107:34: warning: ‘memset’ specified size between 9223372036854775808 and 18446744073709551615 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=]
107 | num->nat = 1, num->end = memset(num->mem, 0, (num->end - num->mem) * sizeof(h_cint_t));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In function ‘cint_right_shifti’,
inlined from ‘cint_sqrt.part.0’ at cint.c:539:4:
cint.c:278:31: note: destination object allocated here
278 | if (num->end - a > num->mem) {
| ~~~^~~~~
Version of gcc:
gcc (Debian 12.2.0-14) 12.2.0
The program appears to function normally despite the warnings, and valgrind doesn't detect any memory leaks. The warning doesn't appear with -O2
.
quadratic_sieve: fac_quadratic.c:522: iteration_part_6: Assertion `R->mem == R->end' failed.
Hello,
I am very gratefull for this project and would like to support it (threading/GPU would be nice)...
Everything seem to work fine most of the time but on Linux WSL at least... i get some segfaults every now an then :
27. 705074515857134286120871238142845541623 = Segmentation fault
The number 705074515857134286120871238142845541623 gives error for me, I tried with -O1... same
I'll dig in a bit more with a debugger...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.