🔒

Cryptography

From Caesar's simple substitution to RSA and elliptic-curve key exchange. Interactive visualisations that demystify the mathematics keeping modern communication secure.

4 simulations RSA · ECC · AES Modular arithmetic · Primes

Category Simulations

Open a simulation — it runs right in your browser

🌳
New ★★★ Advanced
Merkle Tree
Build a Merkle tree by hashing data blocks pairwise up to a single root.
Merkle tree hash tree proof of inclusion
#️⃣
New ★★★ Advanced
Hash Functions
Explore what makes a cryptographic hash strong: flip one input bit and watch ~half the output bits change (the avalanche effect), and see the birth…
hash function avalanche effect collision
⛓️
★★★ Advanced New
Blockchain Consensus
Proof-of-Work mining and longest-chain consensus: miners race to beat the difficulty target, forks resolve, difficulty retargets, and a 51% attacker's success probability is shown.
BlockchainProof of WorkConsensusCanvas 2D
🏛️
★☆☆ Beginner
Caesar & Vigenère Ciphers
Encrypt and decrypt messages with classical substitution ciphers. Frequency analysis attack highlights the most likely key automatically.
Canvas 2DSubstitutionFrequency Analysis
🔑
★★☆ Moderate
RSA Key Exchange
Step through RSA: choose two primes, compute n and φ(n), find e and d. Watch a message encrypted and decrypted with the public/private keypair.
Canvas 2DRSAModular Arithmetic
🤝
★★☆ Moderate
Diffie-Hellman Key Exchange
Two parties establish a shared secret over an insecure channel. The colour-mixing analogy makes the discrete logarithm problem intuitive.
Canvas 2DDHDiscrete Log
📈
★★★ Advanced
Elliptic Curve Cryptography
Visualise point addition on an elliptic curve over a real field. See how scalar multiplication generates a keypair and why reversing it is hard.
Canvas 2DECCPoint Addition

Learning Resources

Deep dives into cryptography and security

About Cryptography Simulations

Ciphers, key exchange, hashing, and public-key cryptography — visualised

Cryptography simulations make the mathematics of secure communication tangible and interactive. Caesar and Vigenère cipher visualisers show classical substitution and polyalphabetic encryption letter by letter, making frequency analysis attacks obvious. RSA key-generation animations walk through Euler's totient function, modular exponentiation, and the relationship between key length and factoring difficulty.

Diffie–Hellman key-exchange simulations animate the public/private colour-mixing analogy and then show the actual modular-arithmetic protocol, demonstrating how two parties can agree on a shared secret over an insecure channel. Hash-function collision visualisers demonstrate the avalanche effect: how a one-bit change in input flips roughly half the output bits. These visualisations serve introductory cybersecurity courses and system designers learning where cryptographic primitives should be applied.

Each simulation in this category is built with accuracy and interactivity in mind. The underlying mathematical models are the same ones used in academic research and professional engineering — just made accessible through a web browser. Changing parameters in real time and observing the results is one of the most effective ways to build intuition for complex scientific and engineering concepts.

Key Concepts

Topics and algorithms you'll explore in this category

Interactive ModelReal-time browser simulation with live parameter controls
WebGL / Canvas 2DHardware-accelerated rendering in the browser
Mathematical FoundationDifferential equations and numerical integration
Open SourceMIT-licensed code — inspect, fork, and learn
No Install RequiredRuns directly in Chrome, Firefox, Safari, Edge
Educational FocusBuilt to explain the underlying science clearly

Frequently Asked Questions

Common questions about this simulation category

How does RSA encryption work?
RSA relies on the difficulty of factoring large integers. You choose two primes p and q, compute n = p·q and φ(n) = (p−1)(q−1), then pick a public exponent e coprime to φ(n) and compute private key d = e⁻¹ mod φ(n). Encrypting a message m gives c = mᵉ mod n; decrypting gives m = cᵈ mod n. The RSA simulation steps through every calculation so you can see exactly how the keys are generated and used.
How does Diffie-Hellman key exchange allow two parties to agree on a shared secret?
Alice and Bob agree on a public prime p and generator g. Alice sends gᵃ mod p (keeping a secret); Bob sends gᵇ mod p (keeping b secret). Alice computes (gᵇ)ᵃ mod p; Bob computes (gᵃ)ᵇ mod p — both equal gᵃᵇ mod p, the shared secret. An eavesdropper sees gᵃ mod p and gᵇ mod p but cannot compute gᵃᵇ mod p without solving the discrete logarithm problem. The colour-mixing analogy in the simulation makes this intuitive.
Why is elliptic curve cryptography (ECC) preferred over RSA for modern systems?
ECC provides equivalent security to RSA with much smaller key sizes — a 256-bit ECC key matches a 3072-bit RSA key in security level. This means faster computation, smaller certificates, and less bandwidth. ECC security rests on the elliptic curve discrete logarithm problem: given points P and Q = k·P on a curve, finding the scalar k is computationally infeasible. The simulation visualises point addition geometry on the real-number curve.
How does frequency analysis break classical ciphers?
In the Caesar cipher every letter is shifted by a fixed amount, so the frequency distribution of ciphertext letters mirrors that of plaintext. In English, 'E' is the most common letter (~13%), so the most common ciphertext letter is likely the encryption of 'E'. The Vigenère cipher uses multiple shifts (a key), flattening frequencies — but index-of-coincidence analysis can still recover the key length. The Caesar and Vigenère simulation shows these attacks in real time.

Other Categories

Learn Cryptography Online

Each Cryptography simulation in this collection turns abstract number theory into something you can watch and adjust in real time. Use the interactive Cryptography model to step through RSA key generation, the Diffie-Hellman exchange, elliptic-curve point addition, hash avalanche behaviour and classical cipher attacks — every parameter is yours to change. Whether you are revising for a cybersecurity exam or designing real systems, you can learn Cryptography online here for free, with no install. The same primitives secure HTTPS connections, banking transactions and messaging apps, so building this intuition has direct real-world value for engineers and analysts alike.