IT lexicon › Security › Modular arithmetic

Modular arithmetic

Security På svenska → Updated: 2026-10-12

Arithmetic on remainders, where numbers wrap around a modulus, and the foundation of nearly all classical and modern cryptography.

In arithmetic modulo 26, 27 equals 1, which is exactly what the Caesar cipher uses when it shifts letters around the alphabet. The affine cipher generalises this to ax + b mod 26, where a must be coprime to 26 for the cipher to be reversible.

The same principle, with numbers hundreds of digits long, carries RSA. Modular exponentiation with large primes is easy to compute forwards but needs the private key to reverse, which makes it a trapdoor function. That a cryptographic system rests on something as modest as remainder arithmetic is one of the more puzzling facts in the subject.

← Back to the lexicon