17 Dec 2021
RSA is dependent on very large primes and it is not practical to have a lookup table of very large primes, so we must find a way to generate primes. We can do this by generating a random odd number then testing if it is prime.
Naïve Test
Suppose we want to check if an odd is prime. We can do trial division for all integers in
This naïve test has a time complexity of , however, this does not mean it is an efficient algorithm (i.e. in the class of polynomial-time algorithms).
Consider the input to the algorithm: a number. Next, we can think of a number as a sequence of digits, and it follows that the number of elements in this sequence is . There exists no polynomial such that , therefore, this naïve algorithm does not run in polynomial time.
In RSA, we deal with numbers exceeding , and given time complexity, we can expect about trial divisions to determine primality using this method.
For illustrative purposes, suppose that , i.e. is the size of the input. If we had an time algorithm for primality, then we can expect about steps to determine if a number around is prime.