We’ve built a collection of 48 exercises that demonstrate attacks on real-world crypto.
This is a different way to learn about crypto than taking a class or reading a book. We give you problems to solve. They’re derived from weaknesses in real-world systems and modern cryptographic constructions. We give you enough info to learn about the underlying crypto concepts yourself. When you’re finished, you’ll not only have learned a good deal about how cryptosystems are built, but you’ll also understand how they’re attacked.
I have just started on the first set of questions. It comes highly recommended by various people. Do check it out!
The exercises arrive in sets, and the first set starts friendly: convert hex to base64, XOR two buffers together, then break a ciphertext encrypted with a single-byte XOR key by scoring candidate plaintexts on English letter frequency. By the end of set one you are detecting which of a pile of ciphertexts was encrypted in ECB mode, because ECB turns identical plaintext blocks into identical output blocks and leaks structure you can count.
Later sets keep the pattern of attacking a real construction instead of memorizing a definition: repeating-key XOR, CBC bit flipping, byte-at-a-time ECB decryption under a controlled prefix, a padding oracle against CBC, and RSA with badly chosen parameters. You build the crypto and then you break what you built, which is the part a textbook cannot give you.
The challenges outlived their original home at Matasano. They moved to cryptopals.com and more sets were added, and they still come up as the standard answer to “how do I learn crypto for real”.
Crypto is unusual as a subject in that its failure modes are all specific: nonce reuse, key reuse across modes, ECB leaking block patterns, IVs that are predictable or ignored. Reading a list of these failures does not stick. Spending an evening counting repeated blocks until the structure of a plaintext falls out of a ciphertext does. After a few of those evenings you stop asking whether some encryption is secure and start asking which pieces get reused, what the attacker can choose, and what they can observe, which are the questions that matter.
Published on by Stanley