Demonstrating How Shor’s Algorithm Cracks the RSA Encryption Standard (POC — 4-bit Version)

We do not use the current industry standard RSA implementation but a version implemented by a fellow coder. A similar procedure will be used once million-qubit Quantum Computers become reality.

Support my Writing

Join as a member through the link below.

Photo by Markus Spiske on Unsplash

First of all — he is not cracking industry-standard RSA. He implemented a 4-bit version of RSA using Python code. I refer to Mr. Smaranjit Ghose, an extremely cool character, whom I have never met but whose work speaks for itself.

This guy actually implemented RSA for 4-bits and a demonstration of Shor’s Algorithm that cracks RSA. Tiny example, but the devil is in the details. And he has done a wonderful job.

You can find the full implementation here as a Jupyter Notebook.

I refactored the code into a project, ran unit tests, added console capabilities and a UI in Flutter.

Enough of the chat — this is our combined code:

That’s the source code and I’m aware that to most of us it has the meaning of ancient Greek. I’ve tried to explain it as much as I can in the comments.

Here’s the Wiki page on RSA:

Welcome to IBM’s quantum computing library:

And here’s the book on quantum computing by IBM (free):

Now comes the coolest part:

I refactored the entire project into a monolithic project coupled with the Python code already available and added a UI in Flutter. This was the result.

Flutter Implementation


This was my first serious Flutter project, and I really enjoyed the process of creating it. This was the output in Linux:

Linux Ubuntu Output

In Chrome:

Google Chrome

My system takes too long for the Android emulator to run, so I decided not to demo that. But it will look the same. This is one of Flutter’s biggest advantages — uniform output across platforms.

Sample output:

Plain Text: Thomas

Cipher Text: 56467465150941795

Cracked Text: Thomas

Hope you enjoyed this article. Quantum computing has a large nnumber of applications. We just need to be clever as to how to useit in its current NISQ formulation.

Support My Writing

Support my writing. Medium is the definitive #1 source of articles on everything written on the Internet — the best of the best content on the web. Join through the link near the bottom. A sincere thanks to all my wonderful subscribers who help me and support my writing every month. Love you all, each and every single one of you. Just keep being awesome!

I believe in your potential and that every one of us is a genius in one way or the other. You’re on Earth for a reason — for a mission. I challenge you — discover it for yourself. Follow your soul — but use your head as well!

Join Medium. This will also help you read thousands of expertly curated articles by the best writers on the Internet. The most exciting, engaging content possible,

This is the referral link:

God bless. Love you all!

Liked the article? You can thank me by buying me a 2 USD ko-fi every month!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store