Hello,
I need to reverse a function with hard Math operations, I'm asking here to check if it's even possible, eventually for help.
public static UInt32 Func_4(UInt32 P, UInt32 X, UInt32 G)
{
UInt64 result = 1;
UInt64 mult = G;
if (X == 0)
return 1;
while (X != 0)
{
if ((X & 1) != 0)
result = (mult * result) % P;
X = X >> 1;
mult = (mult * mult) % P;
}
return (UInt32)result;
}
By "Reversing" I mean this: I know G, I know P, I know the result. I need X.
I tried to translate it again this morning while my mind was clear, but I failed. Is it even possible?
Thank you in advance.