The essence of modular arithmetic

Introduction :

If you have taken math for CS class or tried to understand some cryptography algorithm you probably have been just told that a≡b mod m means that a-b is devisable by m (so have I) but I couldn’t understand why is that useful or what the heck is going on??

Why do we need modular arithmetic?

Almost all crypto algorithms, both symmetric ciphers and asymmetric ciphers, are based on arithmetic within a finite number of elements. Most number sets we are used to, such as the set of natural numbers or the set of real numbers, are infinite. In the following, we introduce modular arithmetic, which is a simple way of performing arithmetic in a finite set of integers.


The formal definition of the mod is great but it’s not much help when you’re trying to solve a problem(at least for me), instead, you can use this intuition which is already familiar to you:



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store