I'm failing to see why 2 can never be used and what weaknesses would be associated with doing so.
There's a similar question asking why it has to be in the form of $2^n$+1 but why not $2^n$
Cryptography Stack Exchange is a question and answer site for software developers, mathematicians and others interested in cryptography. It only takes a minute to sign up.
Sign up to join this communityI'm failing to see why 2 can never be used and what weaknesses would be associated with doing so.
There's a similar question asking why it has to be in the form of $2^n$+1 but why not $2^n$
It is not that RSA becomes insecure when used with public exponent $2$. (In fact, the Rabin Cryptosystem does exactly that.) It's that it doesn't actually work.
The problem is that for $N = pq$ for two primes $p$ and $q$, the function $f : x \mapsto x^2 \bmod N$ is not injective. So it is impossible to invert uniquely. In fact, most elements of the function's range (the set of perfect squares) have $4$ preimages under $f$. (As pointed out by Thomas Pornin, the multiples of $p$ and $q$ have $2$, while $0$ has only one.)
We can get around this problem by choosing $p\equiv q\equiv 3 \bmod 4$ and restricting the domain to the set of quadratic residues. In this case, the function is a trapdoor permutation over the set of quadratic residues if factoring is hard.
One might note, that this is actually a better guarantee than the one we have for the RSA trapdoor permutation, where the security is not known to be implied by the hardness of factoring.
I had this question in my homework and here how I answer it
When we want to pick $d$ as a private key, we calculate it by
$ed = 1\ mod\ \phi(n)$ this means d is modular multiplicative inverse of e in mod $\phi(n)$
and $\phi(n) = (p-1).(q-1)$, $p$ and $q$ are prime numbers.
$\phi(n)$ is always an odd number if $e=2$, $gcd(2,\phi(n)) \neq 1 $ so there is no modular multiplicative inverse of e in mod $\phi(n)$. this means we cant calculate $d$
This method can be used for all numbers with the form of $2^n$