Cryptography is the mathematics that keeps messages secret, proves who sent them, and lets strangers agree on a shared secret in full view of an eavesdropper. This hub gathers the site's cryptography and distributed-systems simulations into one guided starting point, from the 2,000-year-old Caesar cipher to the RSA and elliptic-curve mathematics that secure the modern internet, plus the hashing and consensus tricks that hold a blockchain together.
10 simulations across Cryptography and Distributed Systems
Five simulations, in the order we recommend exploring them
Start with the oldest ciphers in the book, then watch frequency analysis break them in seconds — the reason classical substitution ciphers were retired.
See how two strangers can agree on a shared secret over a channel an eavesdropper can watch, using the colour-mixing analogy for the discrete logarithm problem.
Move to public-key cryptography proper — generate a real keypair from two primes and watch encryption and decryption run with it.
See the modern, more efficient alternative to RSA that secures most HTTPS connections and cryptocurrency wallets today.
Finish with the hashing structure that lets a blockchain prove a transaction is included in a block without downloading the whole chain.
The theory and maths behind the simulations above
From Caesar to consensus — a complete map of the topic
Cryptography is the mathematics of keeping secrets, proving identity, and reaching agreement in the presence of an adversary who can see (and sometimes tamper with) every message. It is one of the oldest applied mathematical disciplines — Julius Caesar reportedly shifted his military messages by three letters — and one of the most consequential: every HTTPS connection, every password database, and every cryptocurrency transaction depends on the ideas gathered in this hub. Each simulation here is a real, runnable implementation of the protocol it demonstrates, not an illustration, so the numbers you see on screen are the numbers the algorithm actually produces.
The Caesar and Vigenère cipher simulation is the natural starting point: a substitution cipher shifts or scrambles the alphabet, and for centuries that was considered secure. The simulation's built-in frequency-analysis attack shows exactly why it isn't — every language has a characteristic letter frequency distribution, and matching a ciphertext's frequencies against English's own reveals the key in seconds. That vulnerability motivated the search for ciphers whose security doesn't depend on keeping the *method* secret, only the *key* — a principle known as Kerckhoffs's principle that underlies every modern algorithm on this page.
The next leap is public-key cryptography, which solves a problem substitution ciphers can't: how do two people who have never met agree on a secret key over a channel an eavesdropper is actively watching? Diffie-Hellman key exchange answers this using the discrete logarithm problem — it's easy to raise a number to a power modulo a prime, but hard to reverse the operation and recover the exponent. RSA takes a related but distinct hard problem, factoring the product of two large primes, and uses it to build a full public/private keypair: anyone can encrypt with the public key, but only the holder of the private key (derived from the original primes) can decrypt. Elliptic curve cryptography achieves the same goal with a different hard problem — the elliptic curve discrete logarithm — that offers equivalent security with dramatically smaller keys, which is why it now secures most HTTPS connections and virtually all cryptocurrency wallets.
The second half of the hub moves from keeping secrets to keeping records honest. A cryptographic hash function like the one in the hash functions simulation takes any input and produces a fixed-size fingerprint with two critical properties: flipping a single input bit changes roughly half the output bits (the avalanche effect), and finding two different inputs that hash to the same output should be computationally infeasible, even though the birthday paradox makes collisions likelier than raw intuition suggests. The Merkle tree simulation shows what you can build once hashing is cheap and reliable: hash data blocks pairwise up to a single root hash, and you can prove any one block is included in the set with only a handful of hashes, not the entire dataset — the structure behind every blockchain's efficiency.
Blockchain consensus ties keys and hashes together into a system that lets mutually distrusting parties agree on a shared history without a central authority. The blockchain consensus simulation shows Proof-of-Work mining in action — miners race to find a hash below a difficulty target, the longest valid chain wins when forks occur, and a simulated 51% attacker's odds of rewriting history are shown explicitly, illustrating exactly why that threshold matters. The distributed consensus, consistent hashing and Bloom filter simulations broaden the picture to distributed systems more generally: Raft and Byzantine fault tolerance solve the agreement problem even when some participants fail or lie, consistent hashing lets a distributed cache or database scale without reshuffling every key whenever a server joins or leaves, and a Bloom filter answers set-membership questions at scale with no false negatives and a tunable false-positive rate.
Together these ten simulations trace cryptography's full arc — from a 2,000-year-old substitution cipher that frequency analysis breaks in seconds, through the public-key mathematics that makes the modern internet possible, to the hashing and consensus mechanisms that let a blockchain function without a bank in the middle. Every protocol here runs step by step exactly as specified, so the keys, hashes and consensus outcomes you see are the actual outputs of the algorithms, not simplified stand-ins — useful whether you're studying for a security exam, building intuition before reading an RFC, or just curious how HTTPS actually keeps a secret.
Common questions about cryptography and blockchain consensus
Every simulation in this hub runs entirely in your browser, with no installation required. Use each interactive model to experiment with ciphers, keys, hashes and consensus protocols, then learn cryptography online at your own pace by tweaking parameters and watching the mathematics play out.