Mathematics
As the subject of cryptography is based on mathematics, this section will introduce some basic concepts that will help you understand the concepts presented later.
Modular arithmetic
Also known as clock arithmetic, numbers in modular arithmetic wrap around when they reach a certain fixed number. This fixed number is a positive number called modulus (sometimes abbreviated to mod), and all operations are performed concerning this fixed number.
Modular arithmetic is analogous to a 12-hour clock; there are numbers from 1 to 12. When 12 is reached, the numbers start from 1 again. Imagine that the time is 9:00 now; 4 hours from now, it will be 1:00 because the numbers wrap around at 12 and start from 1 again. In normal addition, this would be 9 + 4 = 13, but that is not the case on a 12-hour clock; it is 1:00.
In other words, this type of arithmetic deals with the remainders after the division operation. For example, 50 mod 11 is 6 because 50 / 11 leaves a remainder of 6.