Multiply p × q
Proven< 1 ms
Fast polynomial time — still instant even at 4096 bits.
Part 1 · The One-Way Street
Give any computer two big primes and it multiplies them in microseconds. Hand it only the product n = p × q and ask for p and q back — even clever algorithms slam into an exponential wall.
Your browser multiplies growing balanced semiprimes (16 to 96 bits), then tries to crack them using naive Trial Division and Pollard–Brent rho (from Primearium's primes.js) inside a Web Worker.
Ready. Click “Start Live Race” to watch Trial Division and Pollard's rho hit the wall.
| Size | Semiprime n = p × q | p × q | Trial Div | Pollard rho |
|---|
Drag the key size up to real-world RSA-2048 (617 decimal digits). Every extrapolation below is an asymptotic single-core order-of-magnitude estimate — not a live measurement.
< 1 ms
Fast polynomial time — still instant even at 4096 bits.
—
Checks up to √n ≈ 2^(b/2) divisors.
—
Expected ~n^(1/4) ≈ 2^(b/4) steps (birthday paradox).
—
Heuristic L[1/3] scaling anchored at RSA-250 (2020).
Generate two fresh primes of your chosen bit size, multiply them in a blink, then ask the Web Worker to split n back apart.
Click “Try to Crack n” to race Trial Division vs Pollard's rho on this semiprime.
Part 2 · Build Your Own RSA
Pick two small primes p and q, build a real working RSA keypair step by step, and watch each letter of a demo message transform with BigInt modular exponentiation.
Choose two different prime numbers. Keep them in your private workshop — never share them!
n = p × q is the size of our number clock (public). φ(n) = (p − 1)(q − 1) counts numbers sharing no factors with n (secret!).
Pick any number e smaller than φ(n) that shares no common factor with φ(n) (gcd = 1). This goes on the outside of your padlock.
Find the special partner d so that e × d leaves remainder 1 when divided by φ(n). Only someone who knows φ(n) can find d easily!
Anyone can lock a number m by computing c = m^e mod n.
Only you can unlock c back to m by computing m = c^d mod n.
Each letter turns into its Unicode number m, rides through the modular clock to become ciphertext c, then unlocks right back to the original letter.
| Step | Bit of e | Square (acc² mod n) | If bit = 1, × m mod n |
|---|
Part 3 · Diffie-Hellman Key Exchange
How can Alice and Bob agree on a secret key over a public wire when eavesdropper Eve hears every message? First see it with mixing paint — then with real prime-number clock math.
Mixing two paints is easy; un-mixing them back into exact ingredients is nearly impossible. Alice and Bob mix their secret colors with a public base color, trade mixtures in front of Eve, and add their own secret color one last time.
Honest note: Paint is a metaphor for intuition — real computers don't mix pigments. Below is the exact modular arithmetic that makes Diffie-Hellman work on the internet.
Replace “base paint” with a public prime p and generator g. Mixing a secret number means raising to that power modulo p.
Sends public A: 5^6 mod 23 = 8
Computes secret: 19^6 mod 23 = 2
p = 23, g = 5, A = 8, B = 19
Eve knows A = g^a mod p, but to find a she must solve the Discrete Logarithm Problem.
Sends public B: 5^15 mod 23 = 19
Computes secret: 8^15 mod 23 = 2
Part 4 · Research & Proofs
Cryptography sits on a razor's edge between rock-solid number theory theorems and unproven complexity assumptions. Open any card below for exact statements and honest limits.
Fermat's Little Theorem (1640; proved by Euler, 1736): If p is prime and p ∤ a, then ap−1 ≡ 1 (mod p).
Euler's Theorem (1763): For any integer n ≥ 2 and any a with gcd(a, n) = 1, aφ(n) ≡ 1 (mod n).
Since ed ≡ 1 (mod (p−1)(q−1)), write ed = 1 + k(p−1)(q−1) for some integer k ≥ 1. Modulo p: if p ∣ m, then med ≡ 0 ≡ m (mod p). If p ∤ m, Fermat's Little Theorem gives mp−1 ≡ 1 (mod p), hence med = m · (mp−1)k(q−1) ≡ m · 1 = m (mod p). By symmetry, med ≡ m (mod q) in both cases. Because distinct primes satisfy gcd(p, q) = 1, the Chinese Remainder Theorem yields med ≡ m (mod pq). ∎
Real-world precision: Carmichael's function λ(n) = lcm(p−1, q−1) also suffices (used in PKCS#1 / FIPS 186-5). Moreover, production RSA never encrypts raw unpadded messages — randomized padding schemes (OAEP / PSS) are essential to prevent algebraic and chosen-ciphertext attacks.
No theorem proves that integer factorization lacks a fast classical algorithm. The security of RSA rests on an unproven hardness assumption: that no polynomial-time classical algorithm factors general semiprimes.
Multiplication (Proven): Two b-bit integers can be multiplied in O(b log b log log b) time (Schönhage–Strassen, 1971) and asymptotically O(b log b) (Harvey–van der Hoeven, 2019).
What is Proven (Peter Shor, 1994): A fault-tolerant quantum computer can find the period r of f(x) = ax mod n using the Quantum Fourier Transform in polynomial time Õ((log n)3), breaking both integer factoring (RSA) and discrete logarithms (Diffie-Hellman and elliptic-curve cryptography).
Observed Engineering Reality (No Hype): Today's noisy quantum processors cannot factor cryptographically relevant RSA keys. Published resource analyses (such as Gidney & Ekerå, 2021, and follow-up studies) estimate that factoring RSA-2048 requires thousands of error-corrected logical qubits — translating to millions of physical qubits with low error rates, a formidable engineering challenge still far from solved.
Why Upgrade Now? Under “harvest now, decrypt later,” sensitive encrypted traffic recorded today could be decrypted years later if large fault-tolerant quantum machines are built. Cryptographers therefore standardized Post-Quantum Cryptography (PQC) — including NIST's 2024 standards ML-KEM (lattice key encapsulation), ML-DSA (lattice signatures), and SLH-DSA (hash-based signatures). Even lattice hardness remains an unproven Conjecture, but no efficient quantum attack is known against it.