Control C Control V
Control C Control V

Reputation: 29

How do I invert pow?

I've been looking everywhere for a solution, but I found nothing. how would I invert something like this? pow(4, 4, 91). pow(4, 4, 91) returns 74.

and I'm trying to get 4 from the number 74

I've tried using gmpy, yet no luck. (I'm probably going to get some answers that include brute force, and brute forcing is the last thing I want to do)

To clarify, I want to solve for x in the equation y = xa mod N, where y, a, and N are all known.

Upvotes: 0

Views: 309

Answers (1)

Galunid
Galunid

Reputation: 578

Because you're using modulus argument, you can't get the exact same values from before, since there is not only one answer. For example pow(2, 3, 5) == pow(2, 7, 5). In this case should you get 3, or 5? The answer isn't clear at all. This is why what you want to achieve is not really possible. It may be possible if you add additional constraints

Upvotes: 4

Related Questions