CipherMatrix

Cryptography Calculators

Cryptography is the science of protecting information. Classical ciphers such as Caesar, Vigenère, Affine and Hill show how keys and modular arithmetic work, while RSA, Diffie-Hellman and ElGamal introduce the ideas behind modern public-key systems.

Every tool here is a teaching demonstration. The calculators show each intermediate value so you can check homework, prepare for exams or understand how an algorithm really works. They are not meant for protecting real data.

A natural study path is: Caesar and Vigenère ciphers, the Affine and Hill ciphers (which need modular inverses), then modular exponentiation, RSA, Diffie-Hellman and ElGamal.

Cryptography tools

Square & Multiply

Fast modular exponentiation a^b mod n with the binary breakdown of b and a step table.

r ← r² mod n; if bit=1: r ← r·a mod n
Open calculator

Caesar Cipher

Encrypt or decrypt with a shift of 0–25, or brute-force all 25 shifts when the key is unknown. Every letter is shown.

E(x) = (x + k) mod 26
Open calculator

Vigenère Cipher

Encrypt or decrypt with a keyword. Shows the repeated key and the shift applied to every letter.

C(i) = (P(i) + K(i mod m)) mod 26
Open calculator

Affine Cipher

Encrypt or decrypt with E(x) = (ax + b) mod 26. Shows the modular inverse of a and every letter step.

E(x) = (ax + b) mod 26
Open calculator

Hill Cipher

Encrypt or decrypt with a 2×2 or 3×3 key matrix. Shows the determinant, the key inverse mod 26 and every block.

C = K·P mod 26
Open calculator

RSA Calculator

Generate an RSA key pair from two primes and encrypt or decrypt an integer, with every calculation shown.

c = mᵉ mod n
Open calculator

Diffie-Hellman Key Exchange

Walk through a Diffie–Hellman key exchange: public values, shared secret and a check that both sides agree.

s = g^(ab) mod p
Open calculator

ElGamal Encryption Calculator

Generate ElGamal keys and encrypt or decrypt a number modulo a prime, with every calculation shown.

c₁ = gᵏ, c₂ = m·yᵏ (mod p)
Open calculator