Modular Arithmetic

Page #653 of Chapter: Crypto-for-the-rest-of-us

level indicator

****

Cryptography deals with alphabets -- a finite collection of symbols. And therefore if we wish to use integers to do crypto, we need to shy away from its infinity, and restrict ourselves to a finite collection. Historically we picked modular arithmetic to do it (other means await their exploitation!).

In modular arithmetic we map all the integers from -infinity to +infinity into a finite collection: 0,1,2,..(n-1) -- called: The n residue. Where n can be as large as we please -- but finite.

Any integer x will be associated with one number in the n -residue by the formula:

x = k*n + r

where k (an integer) is selected to insure 0 <= r < n. The value of r will be the number that x is mapped into. We write:
x = r mod n
* Version CE-H6703 (SERVER) Crypto Academy