5

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:

  1. I chose: $q = 7$ and $p = 11$
  2. $N = 77$
  3. $phi(N) = 60$
  4. I chose: $e = 29$
  5. $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?

Mike Edward Moras
  • 18,161
  • 12
  • 87
  • 240
Entimon
  • 97
  • 1
  • 4

1 Answers1

6

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>\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.

mikeazo
  • 39,117
  • 9
  • 118
  • 183