PPT Slide
Arithmetic modulo m (for mɬ)
Numbers can get too big when encrypting and decrypting (bigger than the biggest number in type long). We need a way to keep integers small. Use arithmetic modulo m, in which all integers are kept in the range 0..m-1.
is the integer that satisfies
i = q*m+r and 0<=r < m (for some q)
6 mod 5 = 1 1 mod 5 = 1 -4 mod 5 = 1
5 mod 5 = 0 0 mod 5 = 0 -5 mod 5 = 0
If i >=0: Use i%m (remainder when i is divided by m)
See method mod in class Crypto for an analysis.