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
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:
- Generates two random primes p, q using Miller-Rabin primality testing
- Computes n = p·q and the totient φ(n) = (p-1)(q-1)
- Selects public exponent e = 65537 (standard choice)
- Computes private exponent d = e⁻¹ mod φ(n) via extended Euclidean algorithm
- Encrypts: C = M^e mod n — animated as repeated squaring steps
- Decrypts: M = C^d mod n — same animation in reverse
(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.