0

I have to replicate the key set up process of RSA public encryption algorithm.

Basically I am given two random primes, $P = 7$ and $Q = 5$.

I calculate the following

$N = 5 \cdot 7 = 35$

$O(N) = (p-1)(q-1) = 4\cdot6 = 24$

$e = 7$ -> this is the encryption key

To find the decryption key I need to solve the following equation:

$e*d \equiv 1$ (mod $n$) where $0 \le d \le n$.

I have watched YouTube videos where they explain how to calculate the modular inverse using Euclid's Algorithm, but after the first step I end up with:

$35 = 5(7) + 0$

In all the videos I saw, they usually end up with a remainder of $1$ so that they then set the equation to be equal to 1 and then they substitute to calculate the inverse modulo, but I just end up with

$35 = 5(7) + 0$

and I don't know how to proceed.

J. W. Tanner
  • 60,406
helpbolic
  • 3
  • 1

1 Answers1

0

There is a multiplicative inverse of $d$ mod $n$ only when $\gcd(d,n)=1$.

In particular, $\gcd(7,35)=7>1$, so there is no inverse of $7$ modulo $35$.

You won't find $d$ such that $7d\equiv1 \bmod 35$.

If there were, then we'd have $35$ dividing $7d-1$,

so $7$ dividing $7d-1$, so $7$ dividing $1$, which is clearly absurd.

See this Wikipedia page for further information.

J. W. Tanner
  • 60,406
  • No need to refer to Wikipedia when there are many such answers here. And why not help find good dupe targets rather than increase the number of dupes? Organizing the site adds much value. – Bill Dubuque Jan 20 '20 at 22:24
  • 1
    thank you J.W. Tanner, I found my mistake I was supposed to calculate the equation using mod ø(n) and not n. – helpbolic Jan 20 '20 at 22:40
  • @BillDubuque: I think those "duplicates" are qualitatively different: one of them takes for granted that if $\gcd(a,c)\ne1$ then $a$ is not invertible mod $c$ and asks if we can conclude that $ax\equiv b\pmod c$ has no solutions; the other asks for help showing $\gcd(a,n)>1\implies a$ is not invertible mod $n$; here OP was asking about how to find the inverse of $7$ mod $35$ and didn't seem to realize it doesn't exist – J. W. Tanner Jan 20 '20 at 22:52
  • @J.W.Tanner Answers in the dupes give the general criterion for existance of an inverse. What more could one ask for? – Bill Dubuque Jan 20 '20 at 22:55
  • @helpbolic That's a common oversight. We actually have prior questions based on that too. – Bill Dubuque Jan 20 '20 at 23:03
  • @Bill everything on this site is a dupe in some way to another. we'd have 3 questions otherwise. how How and HOW. –  Jan 20 '20 at 23:12