The value is a 24 bit number, as is the result (obviously). The result is subsequently fed into a lookup table of which bits it represents. My plan is to find an efficient algorithm to determine what number $\mathrm{value}$ needs to be to achieve a desired $\mathrm{result}$. If this answer is not within the 24 bit limit, then retry with one of the others that result in the same answer through the lookup table data.

If someone can identify possible algorithm names then I can use that directly, I just can't figure out what this scheme is...

1 Answer
1

If $a$ is a prime number and you know $r$ and $b$, and want to solve $v$ given the equation $r = v*b\mod a$, all you have to do is to apply the extended Euclidean algorithm for finding the multiplicative inverse $b^{-1}\mod a$, and then calculate $v = r*b^{-1}\mod a$. Alternatively, you could apply Fermat's little theorem and calculate $v = r*b^{a-2}\mod a$.

Sadly I don't even have a method of calculating a number as large as 3182^(380951-2). I'm hoping to find a method shorter than calculating the approx 3000 possible multipliers.
–
hsikcahMar 2 '13 at 6:01

Ok, so I implemented the modular exponentiation function using the right to left binary method. 3182^380949 mod 380951=200354 so 200354*83172 mod 380951 = 284246 not the 1434758 I was expecting. Any ideas where I've gone wrong?
–
hsikcahMar 3 '13 at 0:29

Incidentally through experimentation I have determined that 83172+380951*2438=928841710 then 928841710/3182=291905 then 291905 mod 380951 is 291905 so I suspect if I could somehow calculate the 2834 versus exhaustively searching for it then that could be workable solution.
–
hsikcahMar 3 '13 at 0:42