Cryptography: Physics of Secrets
Why AES-256 is unbreakable by physics. The mechanics of RSA (Prime Factoring), ECC (Discrete Logs), and Hash Collisions.
🎯 What You'll Learn
- Deconstruct RSA (The Factoring Problem)
- Analyze ECC (The Discrete Log Problem)
- Trace a Diffie-Hellman Key Exchange
- Calculate the Thermodynamics of Brute Force
- Audit a Hash for Pre-image Resistance
Introduction
Cryptography is not “Secret Writing”. It is Mathematical Warfare. It allows a lone individual to hide a secret that no government, army, or supercomputer can uncover.
It relies on Hard Problems: Math that is trivial to compute one way, but impossible to reverse without a “Trapdoor”. This lesson explores the Physics of the Impossible.
The Physics: Symmetric Encryption (AES-256)
AES is the standard for locking data. It Shuffles, Substitutes, and Mixes bytes in 14 “Rounds”.
The Physics of Brute Force: To crack AES-256, you must check up to keys. The Landauer Limit states the minimum energy to flip 1 bit is (~ J at room temperature). Just counting to — performing bit operations at the thermodynamic minimum — requires roughly joules. The Sun outputs watts. You would need to capture the Sun’s entire energy output for longer than the age of the universe. AES-256 is not just hard to crack. It is thermodynamically impossible to brute-force.
Deep Dive: Asymmetric Encryption (RSA vs ECC)
Symmetric keys are great, but how do I send you the key? Public Key Cryptography.
RSA (The Factoring Problem):
- Easy: .
- Hard: What are the factors of
- Key Size: Requires 3072 bits to be secure. Slow.
ECC (Elliptic Curve Cryptography):
- Easy: .
- Hard: Given , how many times did I add ? (Discrete Log).
- Key Size: Only 256 bits for same security. 1000x faster.
- Physics: Used in Bitcoin, TLS 1.3, Signal.
Strategy: Diffie-Hellman (Paint Mixing)
How do two people agree on a secret color in public without revealing it?
- Public: Yellow Paint.
- Alice: Adds Secret Red. Sends Orange Mixture.
- Bob: Adds Secret Blue. Sends Green Mixture.
- Alice: Adds Secret Red to Bob’s Green -> BROWN.
- Bob: Adds Secret Blue to Alice’s Orange -> BROWN.
Result: Both have the same Shared Secret (Brown). An eavesdropper sees Orange and Green but cannot separate the colors to find the secret.
Code: ECDSA Signing
import ecdsa
import hashlib
# 1. Generate Key Pair (Curve secp256k1)
sk = ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1)
vk = sk.verifying_key
# 2. Sign a Message
message = b"Attack at Dawn"
signature = sk.sign(message)
# 3. Verify the Signature
try:
assert vk.verify(signature, message)
print("Signature Valid!")
except ecdsa.BadSignatureError:
print("WARNING: Forged Signature")
Practice Exercises
Exercise 1: Hash Collision (Beginner)
Task: Find two strings that produce the same MD5 hash. Result: Easy. You can do it in seconds on a laptop. MD5 is broken. Task: Do it for SHA-256. Result: Impossible.
Exercise 2: RSA Key Size (Intermediate)
Scenario: You use 1024-bit RSA. Risk: This can be factored by a Nation State. You must use 2048 or 3072.
Exercise 3: Quantum Threat (Advanced)
Scenario: Shor’s Algorithm runs on a Quantum Computer with 4000 Qubits. Result: It solves Factoring and Discrete Logs instantly. RSA and ECC are dead. AES-256 survives (only weakened to AES-128 via Grover’s Algo).
Knowledge Check
- Why is AES-256 considered thermodynamically secure?
- What is the Hard Problem behind RSA?
- Why do we prefer ECC over RSA today?
- What does Diffie-Hellman achieve?
- Are Hashes reversible?
Answers
- Energy limits. There isn’t enough energy in the solar system to check all keys.
- Integer Factoring. Finding prime factors of a huge number.
- Efficiency. Smaller keys, faster computation, same security.
- Key Exchange. Shared secret over an insecure channel.
- No. They are lossy compression (Pigeonhole Principle).
Summary
- Symmetric: Fast, Unbreakable.
- Asymmetric: Solves Key Exchange (Slow).
- Hashing: Digital Fingerprint.
Want to go deeper?
Weekly infrastructure insights for engineers who build trading systems.
Free forever. Unsubscribe anytime.
You're in. Check your inbox.
Questions about this lesson? Working on related infrastructure?
Let's discuss