how to do the opposite of mod in this equation

256 Views Asked by At

if $X=((A*Y)+C)\mod m$ how does one calculate $Y$? If you have all other variables except Y? I have already tried everything I can think of just don't know how to do the exact opposite of mod, I can have any amount of answers. X=43 A=13477813 C=1 and M=255

1

There are 1 best solutions below

1
On BEST ANSWER

Do it as regular algebra, until divisibility problems caused by mod intervene.

In this case, you get to $X-C=A*Y\mod m$. If $A$ and $m$ are relatively prime, there is a $B$ such that $A*B = 1 \mod m$. Multiply both sides by $B$ so that $B(X-C)=B*A*Y = Y\mod m$.