How can Shor's algorithm be used to crack 32 bit RSA Encryption?


I have this as my minor project and plan to use Shor' Algorithm for factorization to figure out the $p$ and $q$ factors for cracking. Although I understand the theoretical part, I am having some problems in implementing it.

Anshuman Raina

Posted 2018-10-12T14:08:50.037

Reputation: 11

Question was closed 2018-10-12T19:29:52.693

5Could you be more specific about what problem you're encountering? As stated, your question reads an awful lot like "Do my project for me". – Craig Gidney – 2018-10-12T15:19:42.107

Sorry for being quite vague. I actually have studied a bit and am not at all asking for spoon feeding. I just have problem in starting the quantum part of this problem, as to how to approach this step 2 of the article

– Anshuman Raina – 2018-10-12T16:08:05.637

2@Anshuman It would be great if you could edit your question accordingly to make clear what precisely you are looking for! – Norbert Schuch – 2018-10-12T16:11:53.080

Welcome to Quantum Computing SE! As mentioned in the above comments, it's rather difficult to figure out exactly what your problem(s) is/are, so it's going to be particularly hard to provide an adequate answer, so I've put the question on hold to help prevent answers being less helpful than they could otherwise be. If you can identify a specific problem you've got, please [edit] the question and that will automatically put the question in a reopen review queue. If you've got several specific problems, you're very welcome to make multiple posts – Mithrandir24601 – 2018-10-12T19:33:35.270



As Craig Gidney has said in the first comment, you will have to give us further instructions about what specific part of Shor's algorithm you need assistance with, since asking us to work through an entire 32-bit example would be considered "doing your homework for you".

However I see no harm in helping you with the non-quantum part of it, and I think this will be useful for other users who want to learn RSA without reading a rather large Wikipedia page or tutorial which is catered more towards pure math students.

In RSA you will have a public key which contains two numbers: $n$ and $e$. You need to factor $n$ into $p\times q$. Once you have $p$ and $q$ you can calculate Carmichael's totient function of $n$, which is called $\lambda$ and is equal to the lowest common multiple of $p-1$ and $q-1$.

The "private key" $d$ can be found by solving: $e\times d = 1\hspace{-3mm}\mod\hspace{-1mm} \lambda$.

You can now crack the code $c$ to get the original message $m$:

$m=c^d \hspace{-3mm}\mod \hspace{-1mm}n$.


Posted 2018-10-12T14:08:50.037

Reputation: 8 162

2The part that I explained was taught in our first year undergraduate algebra class at University of Waterloo, also it's on Wikipedia and easily accessible. How to break RSA is public knowledge. Anyone who can't figure out how to break RSA by reading Wikipedia, is definitely not going to have the mathematics and programming skills to factor RSA-2048. Even RSA-768 took 5 years on an HPC cluster, running massively parallel codes using MPI and written by the groups of Zimmerman and Lenstra, who know the number theory inside out. I don't think I'm helping anyone crack codes! – user1271772 – 2018-10-14T14:52:49.877