I am working through an example solution in Nigel Smart's Cryptography: An Introduction, 3E, p. 181, about the encryption and decryption of plaintext in Rabin's cryptosystem. The calculation boils down to some modular arithmetic. Unfortunately, I don't have a lot of experience with that, and my answers are not lining up with his. I'd like some help understanding my mistakes.
Here is the portion of the problem I understand and can replicate.
Let the public and private keys be given by
- $p=127$ and $q=131$,
- $N=16637$ and $B=12345$.
To encrypt $m=4410$ we compute
$$c=m(m+B) \mod{N}=4633$$
My solution matches his so far. I took these steps:
$$c=4410(4410+12345)\mod{16637}$$
$$c=73889550\mod{16637}$$
$$c=4633$$
Here is the part that is giving me trouble.
To decrypt we first compute $$t=B^2/4 + c \mod{N}=1500$$
$1500$ doesn't line up with what I'm getting. Here are the steps I took:
$$t=12345^2/4 + 4633\mod{16637}$$ $$t=152399025/4 + 4633\mod{16637}$$ $$t=38099756.25 + 4633\mod{16637}$$ $$t=38104389.25\mod{16637}$$ $$t=5659.25$$
I know I must be making a simple, very ignorant mistake somewhere, but I just can't see it. What am I doing wrong?