A writeup on the Quadratic Sieve algorithm

I am not from a Math background, so it took me a lot of time to understand the simplest version of the Quadratic Sieve algorithm. Each line in any text had at least 2 things I didn't understand and had to go searching for more info. So at the end, I decided to document the algorithm in detail with explanations.

Here is a link - https://risencrypto.github.io/QuadraticSieve/

There is also a link to a Google Spreadsheet inside which contains an example Sieving.

I am sure there are mistakes - so please feel free to point it out - that's one of the main reasons I am posting it here. Same again if something is not clearly explained.

πŸ‘︎ 39
πŸ’¬︎
πŸ‘€︎ u/HenryDaHorse
πŸ“…︎ Aug 14 2021
🚨︎ report
The Quadratic Sieve algorithm for Integer Factorization risencrypto.github.io/Qua…
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/HenryDaHorse
πŸ“…︎ Aug 15 2021
🚨︎ report
The Quadratic Sieve algorithm for Integer Factorization

My writeup on the Quadratic Sieve algorithm - https://risencrypto.github.io/QuadraticSieve/

Many of the popular Asymmetric Cryptography algorithms are based on the difficulty of factoring very large semiprimes (semi prime is a non-prime which factors into exactly 2 primes). Large means 300 digit numbers or 600 digit numbers.

It's easy to multiply 2 large primes & find the product. But reversing it to find the 2 numbers which were multiplied to get the product is a very, very hard problem.

So in the first place, for implementing the algorithm, you have to find very large primes (which are usually found using the Miller-Rabin algorithm).

Studying the reverse (factoring large semiprimes) is important for

  • for attackers trying to attack it

  • you need to know how large a prime can be factored in finite time with current computing power so that you know how large a number you should use to prevent that.

The Quadratic Sieve is the second fastest algorithm for factoring large semiprimes. It’s the fastest for factoring ones which are lesser than 100 digits long.

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/HenryDaHorse
πŸ“…︎ Aug 17 2021
🚨︎ report
r/crypto - A writeup on the Quadratic Sieve algorithm /r/crypto/comments/p4537r…
πŸ‘︎ 3
πŸ’¬︎
πŸ‘€︎ u/svanapps
πŸ“…︎ Aug 15 2021
🚨︎ report
Is the Quadratic Sieve also known as the Double Sieve?

I'm just starting to look at prime factorisation, and I've come across a reference to something called a Double Sieve. However, Google just gives me links for the Quadratic Sieve. Are they one and the same?

πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/hotend
πŸ“…︎ Jun 24 2020
🚨︎ report
Help Understanding the Quadratic Sieve.

So I know someone asked the same question in math.stackexchange but he didn't receive an answer to the question so I am asking it again(I'm copy-pasting his code for example):

  1. Say, for N = 90283, I compute bound 𝐡=𝑒(12+π‘œ(1))(ln(𝑛)ln(lnπ‘›βˆšn))=44, where I take π‘œ(1)=0.22 (just a random guess, I assume). What is the best way to pick good π‘œ(1)?
  2. Then I take 𝐢=⌈√NβŒ‰=301
  3. Then using Sieve of Eratosthenes I get a list of primes < 𝐡:

{2,3,5,7,11,13,17,19,23,29,31,37,41,43}

  1. Then by computing Jabobi (Legendre) symbol for each value in the primes list, I pick the first quadratic nonresidues to get factor base:

{2,3,7,17,23,29,37,41}

  1. Then using the Tonelli-Shanks algorithm I compute modular roots ±𝑑, where 𝑑 is a solution to 𝑑^(2)t≑ 𝑁 (mod 𝑝) with 𝑝 a prime form factor base.

  2. Then I get two arrays of solutions π‘ π‘œπ‘™1 = π‘‘βˆ’πΆ (mod 𝑝) and π‘ π‘œπ‘™2 = βˆ’π‘‘βˆ’πΆ (mod 𝑝), with p's from factor base. and also get one array of logarithms for p's 𝑙𝑝 = ln(𝑝) rounded up to some precision, say two decimal digits. What is a good precision?

sol1 ={0,0,2,13,11,26,10,28}

sol2 ={0,1,5,14,8,10,17,26}

𝑙𝑝 ={0.69,1.1,1.95,2.83,3.14,3.37,3.61,3.71}

Now as far as I understand I have to initialize 'sieving_array' initialized to 0's, say, to size = 60 elements. Also, how should I choose size of the sieving interval? Is there any formula similar to the bound?

  1. Then I have to add values from 𝑙𝑝 to sieving array to positions π‘ π‘œπ‘™1[𝑗]+π‘–βˆ—factor_base[j] and π‘ π‘œπ‘™1[𝑗]+π‘–βˆ— factor_base[j], where 0≀𝑖≀ size and 0≀𝑗≀|factor_base|. And for prime 𝑝=2 add 𝑙𝑝 only to positions with sol1. So I get this list (rounded to two decimal digits):

SieveArray ={1.79,1.1,2.64,1.1,1.79,1.95,1.79,1.1,3.83,3.05,8.77,3.14,3.74,3.93,3.52,1.1,3.74,3.61,1.79,3.05,0.69,1.1,1.79,1.95,1.79,1.1,9.72,1.1,5.5,0.0,6.57,7.07,0.69,3.05,4.93,0.0,1.79,3.05,0.69,4.47,3.74,0.0,1.79,1.1,2.64,1.1,1.79,8.39,4.62,1.1,0.69,3.05,1.79,0.0,10.49,4.47,0.69,4.24,3.74,0.0}

Now I am confused. The next step is(in Contini's paper) is to check each value is log(2x√N) but I don't get what x is. Also can someone please explain how to calculate the size and Sieving Interval? If anyone wants to see the paper it is here and the "qs algorithm to factor n" on page 6.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/DarkStealther
πŸ“…︎ Jan 16 2020
🚨︎ report
Quadratic sieve clarification needed

Trying to understand example of basic sieve in Wikipedia article and stuck in those lines:

  • Since N is small, only 4 primes are necessary.

Why 4 primes are necessary? Why 3 is not enough?

  • Now we construct our sieve V_X of Y(X) = (X + \lceil\sqrt{N}\rceil)^2 - N = (X+124)^2-15347 and begin the sieving process for each prime in the basis, choosing to sieve the first 0 ≀ X < 100 of Y(X):

Why 0 ≀ X < 100 ? not 101 or 99? How upper bound is determined?

πŸ‘︎ 6
πŸ’¬︎
πŸ‘€︎ u/warpod
πŸ“…︎ Jan 27 2015
🚨︎ report
Need help with Quadratic Sieve

Hey, got a crypto final on monday and I'm having a hard time with the quadratic sieve, textbook isn't doing it for me. wondering if anyone can help me out with a pdf or somethin? Also a subquestion: i understand the o-notations, like big-o small-o, big theta etc. and i understand what it means when One function is = some-o of another function. But how do i read an equation with o notation somewhere within in it, like the exponent? maybe this is whats holding me back from understanding the sieve?

πŸ‘︎ 4
πŸ’¬︎
πŸ‘€︎ u/constantillusion
πŸ“…︎ Dec 13 2014
🚨︎ report
Quadratic Sieve - Factor Base Question

If I assume that n is a semi-prime, I want to approximate the size of the factor base using primes less than or equal to B.

I understand that using the Prime Number Theorem, the number of primes less than B is asymptotically (B/ln(B)). I'm trying to understand the proportion of these primes that are moduli to which n is quadratic residue. Any guidance?

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/fibonacci_1729
πŸ“…︎ Nov 09 2012
🚨︎ report
SERIOUS: This subreddit needs to understand what a "dad joke" really means.

I don't want to step on anybody's toes here, but the amount of non-dad jokes here in this subreddit really annoys me. First of all, dad jokes CAN be NSFW, it clearly says so in the sub rules. Secondly, it doesn't automatically make it a dad joke if it's from a conversation between you and your child. Most importantly, the jokes that your CHILDREN tell YOU are not dad jokes. The point of a dad joke is that it's so cheesy only a dad who's trying to be funny would make such a joke. That's it. They are stupid plays on words, lame puns and so on. There has to be a clever pun or wordplay for it to be considered a dad joke.

Again, to all the fellow dads, I apologise if I'm sounding too harsh. But I just needed to get it off my chest.

πŸ‘︎ 17k
πŸ’¬︎
πŸ‘€︎ u/anywhereiroa
πŸ“…︎ Jan 15 2022
🚨︎ report
Weekly Coders, Hackers & All Tech related thread - 14/08/2021

Every week on Saturday, I will post this thread. Feel free to discuss anything related to hacking, coding, startups etc. Share your github project, show off your DIY project etc. So post anything that interests to hackers and tinkerers. Let me know if you have some suggestions or anything you want to add to OP.


The thread will be posted on every Saturday evening.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/avinassh
πŸ“…︎ Aug 14 2021
🚨︎ report
Blind Girl Here. Give Me Your Best Blind Jokes!

Do your worst!

πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Leckzsluthor
πŸ“…︎ Jan 02 2022
🚨︎ report
French fries weren’t cooked in France.

They were cooked in Greece.

πŸ‘︎ 9k
πŸ’¬︎
πŸ“…︎ Jan 20 2022
🚨︎ report
This subreddit is 10 years old now.

I'm surprised it hasn't decade.

πŸ‘︎ 14k
πŸ’¬︎
πŸ‘€︎ u/frexyincdude
πŸ“…︎ Jan 14 2022
🚨︎ report
You've been hit by
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/mordrathe
πŸ“…︎ Jan 20 2022
🚨︎ report
I'm sick of you guys posting dumb wordplay in here for awards and upvotes.

Don't you know a good pun is its own reword?

πŸ‘︎ 11k
πŸ’¬︎
πŸ‘€︎ u/diggitygiggitycee
πŸ“…︎ Jan 21 2022
🚨︎ report
My 4 year oldest favourit joke, which he very proudly memorized and told all his teachers.

Two muffins are in an oven, one muffin looks at the other and says "is it just me, or is it hot in here?"

Then the other muffin says "AHH, TALKING MUFFIN!!!"

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/smoffatt34920
πŸ“…︎ Jan 22 2022
🚨︎ report
Dropped my best ever dad joke & no one was around to hear it

For context I'm a Refuse Driver (Garbage man) & today I was on food waste. After I'd tipped I was checking the wagon for any defects when I spotted a lone pea balanced on the lifts.

I said "hey look, an escaPEA"

No one near me but it didn't half make me laugh for a good hour or so!

Edit: I can't believe how much this has blown up. Thank you everyone I've had a blast reading through the replies πŸ˜‚

πŸ‘︎ 20k
πŸ’¬︎
πŸ‘€︎ u/Vegetable-Acadia
πŸ“…︎ Jan 11 2022
🚨︎ report
What starts with a W and ends with a T

It really does, I swear!

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/PsychedeIic_Sheep
πŸ“…︎ Jan 13 2022
🚨︎ report
Why did Karen press Ctrl+Shift+Delete?

Because she wanted to see the task manager.

πŸ‘︎ 11k
πŸ’¬︎
πŸ‘€︎ u/Eoussama
πŸ“…︎ Jan 17 2022
🚨︎ report
Steve JOBS would have made a better President than Donald Trump

But that’s comparing apples to oranges

πŸ‘︎ 8k
πŸ’¬︎
πŸ‘€︎ u/Ok-Ingenuity4838
πŸ“…︎ Jan 22 2022
🚨︎ report
So 2 trees got arrested in the town I live...

Heard they've been doing some shady business.

πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/K1ll47h3K1n9
πŸ“…︎ Jan 18 2022
🚨︎ report
I was almost upset that my coffee tasted like dirt today

but then I remembered it was ground this morning.

Edit: Thank you guys for the awards, they're much nicer than the cardboard sleeve I've been using and reassures me that my jokes aren't stale

Edit 2: I have already been made aware that Men In Black 3 has told a version of this joke before. If the joke is not new to you, please enjoy any of the single origin puns in the comments

πŸ‘︎ 8k
πŸ’¬︎
πŸ‘€︎ u/scarf_spheal
πŸ“…︎ Jan 19 2022
🚨︎ report
How eggs-traordinary
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Rix27_
πŸ“…︎ Jan 21 2022
🚨︎ report
What is the scariest tree?

BamBOO!

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/K1ll47h3K1n9
πŸ“…︎ Jan 18 2022
🚨︎ report
What is a a bisexual person doing when they’re not dating anybody?

They’re on standbi

πŸ‘︎ 11k
πŸ’¬︎
πŸ‘€︎ u/Toby-the-Cactus
πŸ“…︎ Jan 12 2022
🚨︎ report
A queen size statement.
πŸ‘︎ 4k
πŸ’¬︎
πŸ‘€︎ u/Flight-less
πŸ“…︎ Jan 22 2022
🚨︎ report
I just flew in from Chernobyl

And boy are my arms legs.

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/JhopkinsWA
πŸ“…︎ Jan 23 2022
🚨︎ report
No gains
πŸ‘︎ 8k
πŸ’¬︎
πŸ‘€︎ u/ridi86
πŸ“…︎ Jan 22 2022
🚨︎ report
My ten-year-old daughter came up with this at dinner tonight: What do you get if put a copy of Macbeth on top of a dictionary?

A play on words.

πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/ah1887
πŸ“…︎ Jan 20 2022
🚨︎ report
My son, Luke, loves how I named our kids after Star Wars characters...

My daughter, Chewbecca, not so much.

πŸ‘︎ 8k
πŸ’¬︎
πŸ‘€︎ u/andersonfmly
πŸ“…︎ Jan 21 2022
🚨︎ report
Geddit? No? Only me?
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/shampy311
πŸ“…︎ Dec 28 2021
🚨︎ report
I wanna hear your best airplane puns.

Pilot on me!!

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/Paulie_Felice
πŸ“…︎ Jan 07 2022
🚨︎ report
E or ß?
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Amazekam
πŸ“…︎ Jan 03 2022
🚨︎ report
Which actor drives the least?

Christopher Walken

πŸ‘︎ 3k
πŸ’¬︎
πŸ‘€︎ u/TR1771N
πŸ“…︎ Jan 18 2022
🚨︎ report
What did Spartacus say when the lion ate his wife?

Nothing, he was gladiator.

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/rj104
πŸ“…︎ Jan 15 2022
🚨︎ report
Pun intended.
πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Sharmaji1301
πŸ“…︎ Jan 15 2022
🚨︎ report
No spoilers
πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/Onfour
πŸ“…︎ Jan 06 2022
🚨︎ report
Should we create an English word for the 'day after tomorrow'?

Or would that be too forward thinking?

πŸ‘︎ 2k
πŸ’¬︎
πŸ‘€︎ u/afunkysquirrel
πŸ“…︎ Jan 19 2022
🚨︎ report
Covid problems
πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/theincrediblebou
πŸ“…︎ Jan 12 2022
🚨︎ report
These aren't dad jokes...

Dad jokes are supposed to be jokes you can tell a kid and they will understand it and find it funny.

This sub is mostly just NSFW puns now.

If it needs a NSFW tag it's not a dad joke. There should just be a NSFW puns subreddit for that.

Edit* I'm not replying any longer and turning off notifications but to all those that say "no one cares", there sure are a lot of you arguing about it. Maybe I'm wrong but you people don't need to be rude about it. If you really don't care, don't comment.

πŸ‘︎ 12k
πŸ’¬︎
πŸ‘€︎ u/Lance986
πŸ“…︎ Dec 15 2021
🚨︎ report
Spi__
πŸ‘︎ 6k
πŸ’¬︎
πŸ‘€︎ u/Fast_Echidna_8520
πŸ“…︎ Jan 11 2022
🚨︎ report
What did 0 say to 8 ?

What did 0 say to 8 ?

" Nice Belt "

So What did 3 say to 8 ?

" Hey, you two stop making out "

πŸ‘︎ 9k
πŸ’¬︎
πŸ‘€︎ u/designjeevan
πŸ“…︎ Jan 03 2022
🚨︎ report
I had a vasectomy because I didn’t want any kids.

When I got home, they were still there.

πŸ‘︎ 10k
πŸ’¬︎
πŸ‘€︎ u/demotrek
πŸ“…︎ Jan 13 2022
🚨︎ report
It is really unfortunate that Islam, Christianity, and Judaism have been fighting each other for centuries.

Hindus, on the other hand, never had any beef.

πŸ‘︎ 5k
πŸ’¬︎
πŸ‘€︎ u/Utkarsh_Anand2004
πŸ“…︎ Jan 20 2022
🚨︎ report
I dislike karma whores who make posts that imply it's their cake day, simply for upvotes.

I won't be doing that today!

πŸ‘︎ 15k
πŸ’¬︎
πŸ‘€︎ u/djcarves
πŸ“…︎ Dec 27 2021
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.