Assuming $$c = m ^ e \bmod n$$ and given the values of $c$, $m$ and $n$ (32 bit integers),
How would one find the exponent $e$ (also 32 bit integer) ?
Assuming $$c = m ^ e \bmod n$$ and given the values of $c$, $m$ and $n$ (32 bit integers),
How would one find the exponent $e$ (also 32 bit integer) ?
In this question we are given $c$, $m$ and $n$ (32 bit integers with $0\le c<n$), and asked to find the exponent $e$ (also 32 bit integer, odd and at least $3$) matching the equation of textbook RSA encryption: $c=m^e\bmod n$.
That's impossible with certainty unless $n$ is prime (which would not be RSA) and exactly 32-bit, because then the solution is never unique; either there is no solution, or several values of $e$ are possible. For some parameters (like $m=c=0$, $m=c=1$, or $m=c=n-1$), all odd values of $e$ work. If there's a solution, there is one below $\lambda(n)$ with $\lambda(n)=\operatorname{lcm}(p-1,q-1)$ when $n=p\;q$ with $p$ and $q$ distinct primes; that's the Carmichael function, and is less than $2^{31}$ in an RSA context when $n$ is an at-most-32-bit composite; and then $e+\lambda(n)$ will be at-most-32-bit and also be a solution.
What we can find is the lowest odd value of $e$ at least $3$ such that $c=m^e\bmod n$ holds. The simplest method is perfectly adequate in the context if we can use a computer:
This requires $(e+1)/2$ modular multiplications if a solution is found, and in any case no more than $2^{31}$.
There are at least two independent speedups which would allows to reduce the work, or/and tackle larger parameters: