RSA example-calculation: Public Key = Private Key (e = d) I am a bit confused. I just calculated manually the single steps of RSA for an implementation with small numbers and suddenly $d$ was equal $e$. Please help me understand what I am doing wrong.

Here’s my example:


I chose: $q = 7$ and $p = 11$
$N = 77$ 
$phi(N) = 60$
I chose: $e = 29$
$e \times d + k \times phi(N) = 1 \rightarrow$ Extended Euclidean algorithm
$$k = -14\\ 
   d = 29$$


Test: $29 \times 29 + (-14) \times 60 = 1$

Where is the mistake?
The only reason you are seeing this is because you are dealing with such small primes. With primes like we would use in practice (1024 bits), the probability of this happening is very, very small. And, it can only happen when $e&gt;\sqrt{\lambda(n)}$. Since we typically use $e=65537$ in practice, it is guaranteed to not happen.

Anyways, there is no mistake in your calculations, you just happened to pick an $e$ which is its own inverse.