Weak keys
When RSA really breaksbreaks when keys are made badly: shared primes, primes too close together, or primes with a special shape. Demonstrated on toy keys generated in your browser.
Shared factors: batch GCD
1,000 toy keys from a bad random generator; a product tree finds every pair that shares a prime.
p and q too close
Fermat’s method on toy keys with shrinking gaps, and the rule in the standards that prevents it.
Smooth p − 1
Toy keys built with smooth p − 1 fall to Pollard’s p − 1; “safe” primes don’t.
Small private exponent: Wiener’s attack
Choose the private exponent d too small, for speed, and continued fractions of e/N hand it over. An ordinary key is immune.
One message, many keys: Håstad and the common modulus
Send one unpadded message to three people with e = 3, or share a modulus, and the Chinese remainder theorem gives it away.
Known high bits of p: Coppersmith’s lattice
Leak the top half of a prime and a lattice-reduction step recovers the rest. Exact LLL on BigInt, with the limit measured against the prediction. No faster than brute force at toy size, and the page says so.
Structured primes: a toy ROCA
A key generator that builds primes from a hidden pattern leaves a fingerprint in the public number and a short list to search. Flag, then break, at toy size.
Toy numbers only. Every number factored here is generated in your browser and is at most 64 bits. There is no way to load a real key, and the weak-key chapters exist to show why proper key generation rules each weakness out.