Modulo Calculator

Modular addition, subtraction, multiplication, exponentiation, inverse. Learn modular operations used in RSA cryptography.

Modulo Operation Basics

Modulo operation (a mod m) is the remainder when a is divided by m. Example: 17 mod 5 = 2. Used daily in clock calculations (24-hour), day of week calculations. Essential in programming for array index wrapping, hash functions.

Modular Addition and Multiplication

Modular addition: (a + b) mod m. Modular multiplication: (a × b) mod m. To prevent overflow in large number calculations, take modulo at each step. Example: (12 + 8) mod 5 = 20 mod 5 = 0.

Modular Exponentiation - Fast Computation

When calculating a^b mod m, direct exponentiation makes numbers too large. Using divide-and-conquer fast exponentiation algorithm enables O(log b) time calculation. Core operation of RSA encryption.

Modular Inverse - Extended Euclidean Algorithm

Modular inverse is x such that (a × x) mod m = 1. Exists only when a and m are coprime. Calculated in O(log m) time using Extended Euclidean Algorithm. Used in decryption, fraction calculations.

RSA Cryptography and Modular Operations

RSA is a public-key cryptosystem based on modular exponentiation and inverse. Encryption: c = m^e mod n, Decryption: m = c^d mod n. Relies on the difficulty of factoring n, the product of two large primes.