# Modular mathematics

I have some data which I am encrypting using modulus - (data + 203) mod 200. If the data is 150, I get the result as 153. Is there a way to decrypt and get my data (150) back? I don't know how to calculate inverse of this operation...

Your encrypting operation is the function ƒ(x)=(x+3) mod 200. For a function ƒ: X→Y to be invertible, for every y∈Y there must be one and only one x∈X so that ƒ(x)=y. In your case, the result 153 can be obtained from multiple data values: 150, 350, 550 and so on. There are multiple x∈X that satisfy ƒ(x)=153, so your operation is not an invertible function. In other words, your decryptor cannot possibly know whether the data was 150,350,550...etc. when it receives the encrypted data 153.

mfb
Mentor
data might be limited to a range like [0,199], that would allow decrypting it (simply by taking encrpytedvalue-3 mod 200).

Yes, my data has a range from 1 to 200...

Thanks for the help...i am adding 203 to the data (not 3). I tried doing what mfb suggested. But (153-203) is not possible and (203-153) gives 50. 50 mod 200 doesn't give 150...am I going wrong somewhere?

mfb
Mentor
i am adding 203 to the data (not 3)
That is the same mod 200.
But (153-203) is not possible
Of course it is possible.

That is the same mod 200.Of course it is possible.
Yes...got it. Thanks...