In explanations I've read about public key cryptography, it is said that some large number is come up with by multiplying together 2 extremely large primes. Since factoring the product of large primes is almost impossibly time-consuming, you have security.
This seems like a problem that could be trivially solved with rainbow tables. If you know the approximate size of primes used and know there are 2 of them, you could quickly construct a rainbow table. It'd be a mighty large table, but it could be done and the task could be parallelized across hardware.
Why are rainbow tables not an effective way to beat public key crypto based on multiplying large primes?
Disclaimer: obviously tens of thousands of crazy-smart security conscious people didn't just happen to miss for decades what I thought up in an afternoon. I assume I'm misunderstanding this because I was reading simplified layman explanations (eg: if more than 2 numbers are used) but I don't know enough yet to know where my knowledge gap is.
Edit: I know "rainbow table" relates to using pre-calculated hashes in a lookup table but the above sounds like a rainbow table attack so I'm using the term here.
Edit 2: As noted in the answers, there's no way to store just all of the primes, much less all of their products.
Even if 1 exabyte weighed 1 gram, we're nowhere close to reaching the 2.17 × 10124 needed to be able to fit all of these numbers into a hard drive with the mass of the sun
As our product is bigger and the numbers we use to check are bigger, each check takes more time on average. So, we see that adding a few digits on to our prime numbers makes factoring the product much, much harder. This is why RSA is considered to be secure.
When a composite number is written as a product of all of its prime factors, we have the prime factorization of the number. For example, we can write the number 72 as a product of prime factors: 72 = 2 3 ⋅ 3 2 . The expression 2 3 ⋅ 3 2 is said to be the prime factorization of 72.
Prime numbers are fundamental to the most common type of encryption used today: the RSA algorithm. The RSA algorithm was named after the three mathematicians who first publicly unveiled it in 1977. They commercialised the idea and did very well out of it.
From one of my favorite books ever, Applied Cryptography by Bruce Schneier
"If someone created a database of all primes, won't he be able to use that database to break public-key algorithms? Yes, but he can't do it. If you could store one gigabyte of information on a drive weighing one gram, then a list of just the 512-bit primes would weigh so much that it would exceed the Chandrasekhar limit and collapse into a black hole... so you couldn't retrieve the data anyway"
In other words, it's impossible or unfeasible, or both.
The primes used in RSA and Diffie-Hellman are typically on the order of 2512. In comparison, there are only about 2256 atoms in the known universe. That means 2512 is large enough to assign 2256 unique numbers to every atom in the universe.
There is simply no way to store/calculate that much data.
As an aside, I assume you mean "a large table of primes" - rainbow tables are specificly tailored for hashes, and have no real meaning here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With