New Category: Cryptography & Game Theory

Eight new interactive simulations spanning public-key cryptography, symmetric encryption, cryptographic hashing, strategic decision-making, auction theory, and evolutionary game dynamics. The maths that secures the internet and models human (and ant) behaviour.

The Cryptography & Game Theory category covers two areas that share a surprising amount of mathematical DNA. Both rely on information asymmetry, strategic equilibria, and the limits of rational decision-making. Both are also beautiful topics to visualise — you can literally watch RSA encrypt a message, or watch tit-for-tat strategies dominate a prisoner's dilemma tournament in real time.

The 8 New Simulations

🔑 RSA Key Exchange Generate real RSA key pairs, encrypt a short message, and watch the modular exponentiation C = M^e mod n byte-by-byte on a manageable key size. Miller-Rabin primality · fast modular exp 🔐 AES Block Cipher Step through AES-128 round operations: SubBytes, ShiftRows, MixColumns, AddRoundKey — each transformation animated on the 4×4 state matrix. Rijndael S-box · GF(2⁸) field arithmetic #️⃣ SHA-256 Step-by-Step Watch SHA-256 compress a 512-bit message block: message schedule expansion, 64 rounds of bitwise mixing, and final hash output. Davies-Meyer construction · Merkle-Damgård ⚖️ Prisoner's Dilemma Tournament Run an iterated prisoner's dilemma tournament between classic strategies: Always Defect, Tit-for-Tat, GRIM, Pavlov. Watch score evolution over 200 rounds. Iterated game · Axelrod tournament 🎰 Auction Theory Compare sealed-bid first-price and second-price (Vickrey) auctions. Visualise revenue equivalence between formats and dominant bidding strategies. Bayesian Nash equilibrium · revenue equivalence 🐜 Evolutionary Game Theory Watch hawk, dove, and retaliator strategies compete in a population. Visualise the evolutionarily stable strategy (ESS) as population fractions converge. Replicator dynamics · ESS stability analysis 🔒 Diffie-Hellman Key Agreement Visualise how Alice and Bob agree on a shared secret over a public channel without ever transmitting it, using discrete logarithm hardness. Elliptic-curve DH · discrete log problem 🌐 Network Congestion Game Route traffic through a Braess paradox network. Discover how adding a new road can make everyone slower — a counter-intuitive Nash equilibrium. Wardrop equilibrium · potential game

Featured: The Prisoner's Dilemma

The prisoner's dilemma is the most studied game in all of game theory, precisely because it models a universal tension: what is individually rational leads to a collectively worse outcome. Two suspects, each choosing to cooperate or defect, face this payoff matrix:

Player B: Cooperate Player B: Defect
Player A: Cooperate (3, 3) (0, 5)
Player A: Defect (5, 0) (1, 1) ← Nash

The Nash equilibrium — the outcome where neither player can improve by unilaterally changing strategy — is mutual defection (1,1), even though mutual cooperation (3,3) is better for both. In the iterated version, however, cooperation can evolve. Axelrod's famous computer tournaments showed that Tit-for-Tat — cooperate first, then mirror your opponent's last move — was the highest-scoring strategy across hundreds of entrants.

Featured: RSA Encryption in the Browser

Our RSA simulation uses small (32-bit) primes so every step is auditable, but shows the same algorithm that secures HTTPS. The simulation:

RSA correctness (Euler's theorem)

(M^e)^d ≡ M^(ed) ≡ M^(1 + kφ(n)) ≡ M · (M^φ(n))^k ≡ M · 1^k ≡ M (mod n)

Security assumption: factoring n = p·q is computationally hard for large p, q.
Breaking 2048-bit RSA with best known algorithms: ~10^19 operations.

What connects cryptography and game theory? Both disciplines study strategic behaviour under information asymmetry. Zero-knowledge proofs are literally game-theoretic protocols. Mechanism design — how to structure auctions and contracts to achieve desired outcomes — uses the same equilibrium analysis as cryptographic protocol security proofs.