About this book
Serious Cryptography: A Practical Introduction to Modern Encryption was published by No Starch Press in 2017. Its author, Jean-Philippe Aumasson, is a working cryptographer who designs algorithms and audits the code that uses them. A second edition appeared in 2024, updated for the changes of the intervening years, above all the move toward post-quantum algorithms. This study edition describes the book as a whole and is written mainly with the first edition in view, while noting where the field has moved.
The book sits in a gap that had been open for a long time. On one side were popular histories of codes and ciphers, which explain why secrecy matters but do not teach how a modern cipher is judged. On the other side were graduate textbooks, which define security with full mathematical rigour but assume the reader is comfortable with probability, reductions and proofs. Between them stood a large group of people who actually build software: programmers, security engineers, system designers, auditors and students who need to use encryption correctly and to understand why it fails. Aumasson wrote for that group.
The question the book sets out to answer is simple to state. What does it mean for a cryptographic system to be secure, and how do real systems lose that security? Every chapter returns to this pair. First it explains a building block, such as a block cipher or a hash function, in terms of what it promises. Then it explains how the promise is broken in practice, which is usually not by a clever mathematical attack on the building block itself but by using it in the wrong way.
The tone is direct and economical. There is some mathematics, especially in the chapters on public-key cryptography, but it is introduced only where it is needed and always connected to a concrete consequence. There is code in places, mostly short Python sessions that let the reader see an idea working. The book does not try to be a reference manual and does not try to be complete. It tries to give a reader the right mental model, the vocabulary to read specifications and papers, and a well-developed sense of where danger lies.
The intended reader is someone who already programs and who has heard of AES, SHA-256 and RSA but could not say exactly what each one guarantees. By the end, such a reader should be able to look at a design and ask the right questions. Is the randomness sound? Is this encryption authenticated? Can a nonce repeat? What is the attacker allowed to do? Which hard problem does this rest on, and what happens if a large quantum computer appears? These questions are the practical core of the subject, and the book is organised to make them habitual.
It helps to be clear about what the book is not. It is not a history, though it mentions history when a failure teaches a lesson. It is not a policy book about surveillance or export controls. It is not a guide to a particular library or language. It does not teach the reader to design new ciphers, and in several places it warns against trying. Its aim is narrower and more useful: to make a builder competent to choose, combine and review cryptographic components, and humble about what can go wrong.
The author
Jean-Philippe Aumasson is a Swiss cryptographer. He studied in France and Switzerland and completed a doctorate in cryptography in Switzerland in the late 2000s. His research has covered the design and analysis of symmetric primitives, meaning ciphers, hash functions and related functions that use a single shared key or no key at all.
He is best known as a designer. With colleagues he created BLAKE, a hash function that was one of the five finalists in the competition run by the United States National Institute of Standards and Technology (NIST) to choose the SHA-3 standard. BLAKE did not win; the competition chose Keccak. But BLAKE was widely respected, and its successors BLAKE2 and later BLAKE3 became popular in software because they are fast and simple. With Daniel J. Bernstein he designed SipHash, a short keyed function built to protect hash tables against a class of denial-of-service attacks in which an attacker sends inputs chosen to collide. SipHash was adopted by many programming languages and systems for exactly that purpose.
He has also worked on the practice side. He helped organise the Password Hashing Competition, an open process in the mid-2010s that selected Argon2 as a recommended function for storing passwords. He has worked in industry as a security engineer and researcher, auditing cryptographic code for companies, and he later co-founded a Swiss company working on the custody of digital assets. He has written another book for the same publisher, a short dictionary of cryptographic terms, and he speaks often at security and cryptography conferences.
These facts shape Serious Cryptography in a visible way. A designer knows which properties a primitive is meant to have and how hard it is to give it those properties. An auditor knows that the primitive is rarely where the problem lies. The book carries both kinds of knowledge. When it explains a hash function, it explains the internal structures designers use and why they chose them. When it turns to failures, it draws on the kind of mistakes an auditor finds again and again in real code: keys derived from timestamps, comparisons that leak timing, nonces that repeat after a restart, encryption with no authentication.
Aumasson's position between research and engineering also explains the book's taste. It favours algorithms that are simple to implement correctly, such as ChaCha20 and modern elliptic curves designed with safe implementation in mind. It treats elegance in a specification as a practical virtue, because a specification that is hard to implement will be implemented wrongly. And it is sceptical of complexity, whether in protocols, standards or homemade designs.
The shape of the argument
The book moves from the foundations to the building blocks, then to public-key cryptography, and finally to how everything is assembled in a real protocol and what the future holds. It is useful to see it as four movements rather than as a sequence of separate topics.
First movement: what security means
The opening part establishes the ideas on which everything else rests. It explains what encryption is supposed to achieve, what a model of an attacker is, and why secrecy must rest on the key rather than on hiding the algorithm. It explains randomness, which turns out to be the hidden foundation of almost every cryptographic system, and the difference between true entropy and the output of a deterministic generator. And it explains how cryptographers quantify security: what a security notion is, what it means to claim a certain number of bits of security, and the difference between a proof that something is secure under assumptions and a guarantee that it is secure in the world.
Second movement: symmetric primitives
The middle of the book covers the tools that use a single secret key or no key. Block ciphers, with AES as the central example, and the modes of operation that turn a block cipher into a way of encrypting long messages. Stream ciphers, which generate a long keystream from a key and a nonce. Hash functions, which turn arbitrary data into a short fingerprint. Keyed hashing, which produces message authentication codes and pseudorandom functions. And authenticated encryption, which combines secrecy and integrity into one operation and which the book presents as the right default for nearly all uses.
Third movement: public-key cryptography
The third part introduces the mathematics that makes public-key cryptography possible. It explains what makes a problem computationally hard, the role of complexity theory, and the specific problems used in practice, mainly factoring large numbers and computing discrete logarithms. It then covers the three families built on these problems: RSA, Diffie-Hellman key agreement, and elliptic-curve cryptography. Here the mathematics is heavier, but always tied to practical questions such as key sizes, padding and parameter choice.
Fourth movement: assembly and the future
The last part shows how the pieces fit together in TLS, the protocol that secures most traffic on the web, and how its newer version removed many of the dangerous options of older versions. It then turns to quantum computing: what a large quantum computer would break, what it would only weaken, and what kinds of algorithms are being developed to resist it.
The recurring counterpoint
Running through all four movements is a counterpoint. Most chapters close with a section on how things go wrong. These sections are the moral centre of the book. They show that the gap between a sound primitive and a secure system is large, and that it is filled with ordinary engineering errors. A reader who absorbs only these sections will already be a more careful builder. A reader who also absorbs the explanations before them will understand why each mistake is a mistake, and so will be able to recognise new mistakes that the book does not list.
The argument, then, is cumulative. Each part supplies concepts that the next part uses. Security notions defined early are used to judge modes of operation in the middle. Hash functions and MACs from the middle are used inside signatures and key derivation in the third part. Everything is used in the discussion of TLS. The final chapter asks which of these foundations survive a change in the model of computation itself.
Idea one: security is a game with rules
The most important idea in modern cryptography is that security must be defined before it can be claimed. A cipher is not secure in the abstract. It is secure against a particular kind of attacker, who is allowed to do particular things, and who wins if they achieve a particular goal. The book teaches the reader to state these three elements every time.
The attacker's powers
Consider what an attacker might be able to do. In the weakest model, they can only see ciphertexts, the encrypted messages, and must learn something from them. In a stronger model, they know some pairs of plaintext and ciphertext, perhaps because a message has a standard header. In a stronger model still, they can choose plaintexts and have them encrypted, as when a web page causes a browser to send requests containing attacker-chosen data alongside a secret cookie. In the strongest common model, they can also submit ciphertexts of their choice and learn something about how they decrypt, even if only whether decryption succeeded.
These models are not academic. The chosen-plaintext model describes many real web attacks. The chosen-ciphertext model describes servers that respond differently to malformed messages, which is exactly the situation exploited by padding oracle attacks. A system designed to resist only the weaker models can be destroyed by an attacker with the stronger powers that the real environment gives them.
The attacker's goal
Next, consider what counts as winning. Recovering the key is the most dramatic goal, but it is not the right standard, because a cipher can leak a great deal without ever giving up its key. The modern standard is indistinguishability. Imagine a challenger who holds a secret key. The attacker gives the challenger two messages of the same length. The challenger encrypts one of them, chosen at random, and hands back the ciphertext. The attacker must say which message was encrypted. If the attacker cannot do better than a coin toss, the ciphertext reveals nothing useful about the message.
This definition has an important consequence. A scheme that always encrypts the same message to the same ciphertext cannot meet it under chosen-plaintext attack, because the attacker can ask for encryptions of both candidate messages and compare. So secure encryption must be randomised or must use a value that never repeats. This one observation explains why nonces and initialisation vectors exist, and why their misuse is so dangerous.
Why this matters for a builder
A builder who thinks in these terms stops asking whether a system is encrypted and starts asking what the attacker can see, what they can influence, and what they would gain. That shift prevents many errors. A login token encrypted without authentication may be unreadable, yet an attacker who can flip bits in it may still change the user identifier inside. The encryption met a goal, but not the goal that mattered.
A common confusion is to treat the strength of the primitive as the strength of the system. AES with a 128-bit key is believed to resist every practical attack on the cipher itself. A system using AES can still be trivially broken if the attacker has powers the designer did not consider. The game-based view keeps the two levels apart. It also leads naturally to the idea of a proof by reduction: showing that if someone could break the system in the defined game, they could also break an underlying primitive or solve a hard problem. Such proofs do not guarantee security in the world, but they move the question to a place where it can be examined.
Idea two: randomness is the hidden foundation
Almost every cryptographic operation depends on unpredictable numbers. Keys must be unpredictable. Nonces and initialisation vectors must be unique and, in some modes, unpredictable. Signature schemes may require a fresh secret value for every signature. Protocols use random challenges to prevent replay. If the random numbers are weak, everything built on them is weak, however strong the algorithms.
Entropy and generators
The book separates two things that are often merged. Entropy is a measure of uncertainty: how hard it is to guess a value. It is gathered from physical sources such as timing of hardware events, electrical noise or dedicated hardware circuits. A pseudorandom number generator is a deterministic algorithm that takes a small amount of entropy, called a seed, and stretches it into a long stream of output that looks random to anyone who does not know the seed.
A cryptographic generator must satisfy stronger conditions than a generator used for simulations or games. Its output must be unpredictable even to someone who has seen a large amount of previous output. Ideally, if its internal state is compromised at some moment, past outputs should remain secret and future outputs should become secret again once fresh entropy is added. Ordinary generators found in many programming languages, designed for speed and statistical quality, do not meet these conditions. Their internal state can often be reconstructed from a modest amount of output, after which every future value is known.
How randomness fails
Real failures follow a few patterns. A program seeds its generator with the current time, so an attacker who knows roughly when a key was created can try every plausible seed. A device generates keys immediately after booting, before its operating system has gathered enough entropy, so many devices produce keys from the same small set of possibilities. A virtual machine is cloned along with its generator state, so two machines produce identical random streams. A programmer uses the general-purpose random function of a language instead of the cryptographic one because the names look similar.
There have been documented cases of each pattern. Studies of public keys collected across the internet found many devices sharing keys or sharing prime factors, which allowed those keys to be broken directly; the cause was poor entropy at key generation time. A change to a widely used cryptographic library once removed a line that fed entropy into its generator, leaving it able to produce only a small number of distinct keys for a period of years on affected systems. The lesson the book draws is consistent: use the operating system's cryptographic generator, and do not invent another one.
Randomness and blockchains
For readers interested in cryptocurrencies, this chapter is worth reading twice. Wallet keys are random numbers. If they are generated with a weak source, funds can be taken by anyone who reproduces the generation process. Signature schemes such as ECDSA need a fresh secret value for every signature, and reuse or bias in that value can reveal the private key. These are not hypothetical risks; they have caused real losses. A builder who understands entropy will treat key generation as the most sensitive step in any system.
Idea three: measuring strength in bits
Cryptographers express strength in bits of security. A scheme has n bits of security if the best known attack needs about two to the power n operations. A 128-bit key, if the cipher has no weakness, means an attacker must try on average about half of two to the power 128 keys. This number is so large that no conceivable classical computer could exhaust it.
What the number means and does not mean
The measure is useful because it lets different schemes be compared on one scale. An RSA key of about 3,072 bits is commonly estimated to give roughly 128 bits of security, because factoring is much easier than trying every possible key. An elliptic-curve key of about 256 bits gives about the same. A hash function with a 256-bit output gives about 128 bits of security against collisions, because of the birthday effect described below. Bits of security turn these disparate sizes into a single question: how much work does the best attack require?
The measure has limits that the book takes care to state. It counts operations of the best known attack, and better attacks may be found. It does not count memory, parallelism or the cost of communication, which can matter greatly. It does not count attacks on implementations, such as side channels, which ignore the mathematics entirely. And it assumes a classical computer; quantum algorithms change the count for some problems, as the final part of the book explains.
Information-theoretic and computational security
The book distinguishes two kinds of security. The one-time pad, which combines a message with a truly random key of the same length used only once, is secure against an attacker with unlimited computing power. The ciphertext gives literally no information about the message, because every message of that length is equally consistent with it. This is information-theoretic security.
The one-time pad is impractical for almost all uses, because the key must be as long as all the data ever sent and must be exchanged in advance. Every practical cipher therefore gives up perfection and offers computational security: breaking it is possible in principle but would take an infeasible amount of work. This trade is the founding bargain of modern cryptography. It explains why bits of security matter, why hardness assumptions matter, and why progress in computing, including quantum computing, is relevant.
The birthday effect
One quantitative idea recurs throughout the book. In a group of only 23 people, there is better than an even chance that two share a birthday, although there are 365 possible days. In general, among values drawn at random from a set of size N, a repeat becomes likely after about the square root of N draws. For a 64-bit value, that is about four billion draws, which is within reach. For a 128-bit value, it is about two to the power 64, which is still very large but far smaller than two to the power 128.
The birthday effect governs the collision resistance of hash functions, the safe lifetime of keys in some modes of operation, the safe size of random nonces, and the danger of block ciphers with small block sizes. Practical attacks on older 64-bit block ciphers used in web and VPN protocols exploited exactly this, by collecting enough encrypted data for blocks to collide. A builder who understands the birthday bound knows when a value that looks large is in fact too small.
Idea four: block ciphers and the modes that use them
A block cipher is a keyed permutation of fixed-size blocks. Given a key, it maps each possible 128-bit block, in the case of AES, to a different 128-bit block, and the mapping can be reversed with the same key. Ideally, for anyone without the key, the mapping looks like a random permutation chosen from the astronomically many possibilities.
Inside a block cipher
The book explains the internal designs that make this possible. A cipher is built from rounds, each of which mixes the data and combines it with a round key derived from the main key. Some designs, such as the old DES, split the block in two halves and alternate between them; this structure is called a Feistel network and has the convenient property that decryption uses the same circuit as encryption. Others, such as AES, apply a substitution step and a permutation step to the whole block each round; this is called a substitution-permutation network. The aim in both cases is confusion and diffusion: every output bit should depend on every input bit and every key bit in a complex way.
Understanding this structure is not necessary for using AES, but it explains why the number of rounds matters, why attacks on reduced-round versions are published as research results without endangering the full cipher, and why implementation details such as table lookups can leak information through timing.
Modes of operation
A block cipher alone encrypts one block. Real messages are longer. A mode of operation defines how to apply the cipher to a sequence of blocks. This is where the book's game-based view becomes concrete.
The simplest mode encrypts each block independently with the same key. It is called electronic codebook mode. Because identical plaintext blocks produce identical ciphertext blocks, patterns in the data survive encryption. An image encrypted this way still shows its outlines. This mode fails the indistinguishability test immediately and should not be used for data longer than a block.
Cipher block chaining combines each plaintext block with the previous ciphertext block before encrypting it, starting from a random initialisation vector. This hides patterns, but it requires padding to fill the last block and it decrypts in a way that, if the system reveals whether the padding was valid, lets an attacker decrypt messages one byte at a time. This padding oracle attack has broken many real systems, including versions of web protocols and frameworks.
Counter mode encrypts a sequence of counter values and combines the result with the plaintext, turning the block cipher into a stream cipher. It needs no padding, can be parallelised, and is simple. Its danger is that if the same key and starting counter are ever used twice, the two messages are encrypted with the same keystream, and combining the two ciphertexts cancels the keystream and exposes the relation between the plaintexts.
The lesson of modes
The deeper lesson is that the mode, not the cipher, determines most of the security properties a user experiences. AES itself has withstood more than two decades of analysis. Systems using AES have been broken repeatedly because of the mode they chose, the way they handled initialisation vectors, or the information their error messages revealed. When someone says a system uses AES, the right response is to ask in what mode, with what nonce handling, and with what authentication.
Idea five: stream ciphers and the discipline of nonces
A stream cipher produces a long sequence of pseudorandom bits, the keystream, from a key and a nonce. Encryption combines the keystream with the plaintext using the exclusive-or operation, and decryption does the same. The operation is fast and simple, and the security rests entirely on the keystream being unpredictable and never reused.
Hardware and software designs
The book describes two traditions. Hardware-oriented stream ciphers use structures such as shift registers, which are cheap to build in silicon. Many older designs of this kind were weak, and their failures in mobile telephony and other systems are part of the history of the field. Software-oriented ciphers are designed to run quickly on general processors using operations such as addition, rotation and exclusive-or. Salsa20 and its variant ChaCha, designed by Daniel J. Bernstein, are the leading examples. ChaCha20 is now standard in TLS and in many other protocols, especially on devices without hardware support for AES.
The cautionary story of RC4
RC4 was for many years the most widely used stream cipher in software, appearing in early wireless encryption and in web protocols. It was simple and fast. Over time researchers found biases in its output, especially in its first bytes, and these biases were eventually exploited to recover secrets such as cookies from encrypted web traffic when enough encryptions of the same secret could be collected. The use of RC4 in the first wireless security standard was worse still, because the way keys and initialisation vectors were combined allowed the key to be recovered from a modest amount of traffic. RC4 is now prohibited in modern protocols.
The book uses this history to make a point that generalises. A cipher can be used safely for years while its weaknesses are being found. Once a weakness is found, attacks improve. The right response is to move away early, before attacks become practical, and to design systems so that algorithms can be replaced.
Nonces
A nonce is a number used once. In stream ciphers and in counter-based modes, the nonce ensures that each message gets a different keystream under the same key. The whole security of the scheme depends on this uniqueness. If a nonce repeats, an attacker who combines the two ciphertexts removes the keystream and gets the combination of the two plaintexts, from which the plaintexts can often be recovered, especially if one of them is partly known.
Nonces repeat for mundane reasons: a counter stored in memory resets when a device restarts; two devices share a key and each starts its counter at zero; random nonces are too short, so the birthday effect produces collisions after many messages. The book teaches the reader to ask, for every encryption in a design, where the nonce comes from and what guarantees its uniqueness. That question, asked consistently, prevents a large class of failures.
Idea six: hash functions and their many jobs
A cryptographic hash function takes input of any length and produces a fixed-length output, called a digest. It is used for integrity checks, digital signatures, password storage, key derivation, commitment schemes, proof-of-work and the linking of blocks in a blockchain. Because it has so many jobs, it must satisfy several distinct properties, and the book separates them carefully.
Three security properties
Preimage resistance means that given a digest, it is infeasible to find any input that produces it. Second-preimage resistance means that given one input, it is infeasible to find a different input with the same digest. Collision resistance means that it is infeasible to find any two different inputs with the same digest. Collision resistance is the hardest to achieve, and because of the birthday effect, a hash with an n-bit output can offer at most about n divided by two bits of collision resistance. That is why modern hashes have outputs of at least 256 bits.
The distinction matters because uses differ. A digital signature on a document is threatened by collisions: an attacker who can find two documents with the same digest can get one signed and claim the signature for the other. Practical collisions were found first for MD5 and later for SHA-1, and attackers exploited MD5 collisions to forge certificates. Password storage, in contrast, depends mainly on preimage resistance and on being slow to compute, which is a different requirement altogether.
How hash functions are built
The book explains the two main constructions. The older one processes the message in blocks, feeding each block together with a chaining value into a compression function; MD5, SHA-1 and SHA-2 use this approach. It has a structural weakness called length extension: given the digest of a secret message, an attacker can compute the digest of that message with extra data appended, without knowing the secret. Systems that authenticate data by hashing a secret key followed by the message have been broken this way. The newer construction, the sponge used by Keccak and thus by SHA-3, absorbs input into a large internal state and then squeezes output from it. It does not suffer from length extension.
Readers who work with blockchains will meet both. Bitcoin uses SHA-256, applied twice in many places, partly as a defence against length extension. Ethereum uses Keccak-256, the version of Keccak submitted to the competition, which differs in a small padding detail from the final SHA-3 standard. Knowing that difference prevents a confusing class of bugs in which two libraries both claim to compute the same hash and produce different results.
Password hashing
Storing passwords is a distinct problem. A fast hash is a weakness here, because an attacker who steals a database of password digests can test billions of guesses per second. Password hashing functions are deliberately slow and, in modern designs, deliberately memory-hungry, so that specialised hardware gains less advantage. They also use a unique random salt for each password, so that identical passwords produce different digests and precomputed tables are useless. Argon2, selected by the Password Hashing Competition, is the modern recommendation, alongside older choices such as bcrypt and scrypt.
Idea seven: keyed hashing and authentication
Encryption keeps data secret. It does not, by itself, prevent data from being changed. Authentication is the separate property that a message really came from someone holding the key and was not altered. In the symmetric setting this is provided by a message authentication code, or MAC: a short tag computed from the key and the message, which the receiver recomputes and compares.
HMAC and other constructions
The most widely used MAC is HMAC, which wraps a hash function in two nested applications with the key processed in a specific way. Its design avoids the length-extension problem and has a well-understood security analysis. Other MACs are built from block ciphers, and some, such as Poly1305, are built from simple arithmetic and are extremely fast but must never use the same key for two messages. The book explains when each type fits.
Keyed hash functions also serve as pseudorandom functions, which are the basis of key derivation. A key derivation function takes a secret, perhaps the output of a key exchange, and produces several independent keys for different purposes: one for encryption in each direction, one for authentication, and so on. Using a single key for several purposes is a classic mistake, because an attacker may use one role of the key to attack another. HKDF, built on HMAC, is the common standard for this task.
Timing and comparison
A small but instructive failure appears here. When a receiver checks a MAC tag, the natural code compares the received tag with the expected tag byte by byte and stops at the first difference. The time taken then reveals how many leading bytes were correct. An attacker who can measure response times precisely can guess the tag one byte at a time, turning an infeasible search into a short one. The fix is a comparison whose running time does not depend on where the difference lies. This example teaches a broader point: an implementation leaks information through every observable behaviour, including time, power use and error messages, and cryptographic code must be written with that in mind.
Hash tables and SipHash
The author's own SipHash belongs to this family. Programming languages use hash tables everywhere, and if an attacker can predict the hash function, they can send many inputs that all land in the same bucket, making each operation slow and bringing a server to a halt. A short keyed function with a secret key chosen at startup makes collisions unpredictable. This is a modest problem compared with signatures and key exchange, but it shows how cryptographic thinking applies to ordinary software engineering.
Idea eight: authenticated encryption as the default
If one practical recommendation from the book had to be chosen above all others, it would be this: when encrypting data, use an authenticated encryption scheme. Authenticated encryption provides secrecy and integrity in one operation. The receiver either gets the original message or an error, never a modified message.
Why encryption alone is not enough
Without authentication, many modes of encryption are malleable. In counter mode or with a stream cipher, flipping a bit in the ciphertext flips the same bit in the decrypted plaintext. An attacker who knows the format of a message can change an amount, a user identifier or a command without knowing the key. In block-chaining modes, malformed ciphertexts can trigger error behaviour that leaks the plaintext, as in padding oracle attacks. Authentication closes these doors because any modified ciphertext is rejected before it is processed.
Ways to combine encryption and a MAC
Before integrated schemes became common, designers combined a cipher and a MAC themselves, and there are three ways to do it. One can authenticate the plaintext and encrypt both, authenticate the plaintext and send the tag alongside the ciphertext, or encrypt first and then authenticate the ciphertext. The third approach, encrypt-then-MAC, is the one with the clearest security guarantee, because the receiver can reject a forged ciphertext without ever decrypting it. Several real protocols chose one of the other orders and paid for it with attacks that exploited processing of unauthenticated data.
Integrated schemes and their sharp edges
Modern practice uses integrated schemes. AES-GCM combines counter-mode encryption with a fast polynomial-based authenticator and is standard in TLS and many other systems, especially where processors have instructions that accelerate AES. ChaCha20-Poly1305 combines Bernstein's stream cipher and MAC and is the common alternative. Both accept associated data, meaning information that is authenticated but not encrypted, such as a packet header.
Both also have a sharp edge: they require that a nonce is never reused with the same key. For AES-GCM, nonce reuse is catastrophic, not only exposing the relation between plaintexts but also allowing the attacker to recover the authentication key and forge messages afterwards. The book discusses nonce-misuse-resistant designs, which degrade gracefully if a nonce repeats, and the general principle that a good interface should make misuse hard. The builder's practical rules are clear: use an authenticated scheme from a well-reviewed library, generate nonces in a way that guarantees uniqueness, and limit the amount of data encrypted under one key.
Idea nine: hard problems and public keys
Public-key cryptography lets two parties who have never met establish a shared secret, and lets one party sign data that anyone can verify. It depends on mathematical problems that are easy to set up and hard to undo. The book explains this foundation before turning to specific systems.
What hard means
Complexity theory classifies problems by how the effort needed to solve them grows with the size of the input. The book introduces the classes informally: problems that can be solved efficiently, problems whose solutions can be checked efficiently even if finding them seems hard, and the famous open question of whether these two classes are the same. It then makes a point that is often missed. Cryptography does not use the hardest problems in the classification, because those are hard only in the worst case. It needs problems that are hard on average, for randomly generated instances, and for which no efficient algorithm is known despite long study. Factoring and discrete logarithms are such problems. Their hardness is an assumption, supported by decades of failed attempts, not a theorem.
RSA
RSA rests on the difficulty of factoring the product of two large primes. The public key includes the product; the private key depends on knowing the factors. The book explains the arithmetic, then concentrates on the practical traps. Raw RSA, applying the mathematical operation directly to a message, is deterministic and malleable and must never be used. Encryption needs a padding scheme that adds randomness and structure; the older padding standard allowed chosen-ciphertext attacks in which a server's responses to malformed messages let an attacker decrypt, a family of attacks first published in the late 1990s and rediscovered in new forms many times since. The newer padding scheme, OAEP, and the signature scheme PSS have sound security arguments. Key sizes must be large, and implementations must avoid leaking the private key through timing or faults.
Diffie-Hellman
Diffie-Hellman key agreement, published in 1976, lets two parties each pick a secret, exchange values derived from those secrets in public, and arrive at the same shared value, which an eavesdropper cannot compute if the discrete logarithm problem is hard. The book stresses that the plain exchange provides no authentication: an attacker in the middle can run separate exchanges with each party. Real protocols therefore combine key agreement with signatures or certificates. It also explains the importance of parameter choice and of validating values received from the other party, since malformed values can leak information about the private key.
Elliptic curves
Elliptic-curve cryptography uses the same ideas over a different mathematical structure: points on a curve, combined by a geometric addition rule. The discrete logarithm problem on well-chosen curves is much harder for its size than the equivalent problem on ordinary numbers, so keys and signatures are much shorter for the same security. A 256-bit curve key is roughly comparable to a 3,072-bit RSA key.
The book covers the main signature and key-agreement schemes. ECDSA is the standard signature algorithm and is used by Bitcoin and Ethereum on the curve called secp256k1. It requires a fresh secret value for each signature; if this value is reused or even slightly biased, the private key can be recovered. This exact mistake was made in a games console signing system and in some cryptocurrency wallets, with the consequences one would expect. Modern alternatives such as Ed25519, a signature scheme on a curve designed by Bernstein and colleagues, derive this value deterministically from the message and key, removing the risk. Curves such as Curve25519 were also designed so that simple implementations are less likely to leak secrets, which reflects the book's general preference for designs that are hard to misuse.
Idea ten: protocols and the quantum horizon
Primitives become useful only when assembled into protocols. A protocol fixes who sends what, in what order, with what checks. Most real attacks on cryptography exploit protocol logic or implementation, not the primitives.
TLS as the main case study
The book uses TLS, the protocol behind secure web browsing, as its case study. TLS has a handshake, in which client and server agree on algorithms, authenticate the server with a certificate, and derive shared keys, followed by a record layer that encrypts and authenticates application data. Older versions carried a long list of options, including weak ciphers, export-grade keys deliberately limited in strength, compression that leaked secrets through message lengths, and modes vulnerable to padding oracles. Many named attacks of the 2010s targeted these options and the logic that negotiated them.
TLS 1.3, finalised in 2018, removed most of these options. It allows only authenticated encryption, requires key agreement methods that give forward secrecy, so that stealing a server's long-term key later does not expose past sessions, and simplifies the handshake. The book presents it as a model of how a protocol can improve by removing choices. It also explains the remaining risks: certificate validation errors, implementation bugs and the difficulty of keeping libraries correct.
Implementation as part of the protocol
The book also makes clear that a protocol specification is only half of a protocol. The other half is the code that implements it, and that code must parse untrusted input, manage memory, handle errors and keep secrets out of logs. Some of the most damaging security incidents of the past decade involved cryptographic libraries but had nothing to do with cryptography in the mathematical sense. A missing bounds check let attackers read memory from servers, including private keys. A duplicated line of code caused a certificate check to be skipped. A state machine accepted messages in an order the specification forbade. In each case the algorithms were sound and the protocol design was reasonable; the failure lay in ordinary programming.
The practical consequence is a preference for small, well-tested libraries with simple interfaces, written by people who specialise in this work, over large frameworks with many options. It also explains the growing interest in formally verified implementations, where the code is mathematically checked against its specification, and in memory-safe languages for cryptographic and network code. A builder cannot verify a library alone, but can choose libraries whose maintainers take these measures, keep them updated, and avoid adding configuration that the library's designers deliberately left out.
There is a final lesson about agility. Because primitives weaken over time and protocols accumulate flaws, systems should be designed so that algorithms can be replaced without redesigning everything. Yet negotiation between algorithms was itself the source of many downgrade attacks on older TLS. The book's implicit answer is to support few algorithms at any moment, make the choice explicit and authenticated, and plan for replacement through versioning rather than through open-ended option lists.
Quantum computing
The final idea concerns a change in what computers can do. A large, fault-tolerant quantum computer could run Shor's algorithm, which factors numbers and computes discrete logarithms efficiently. That would break RSA, Diffie-Hellman and elliptic-curve cryptography entirely, including the signatures used by nearly every blockchain today. Grover's algorithm, by contrast, offers only a square-root speed-up for searching, so it would reduce the security of symmetric ciphers and hash functions but not break them; doubling key lengths restores the margin, which is why 256-bit keys are recommended for long-term protection.
No such machine exists at the time of writing, and estimates of when one might exist vary widely. The book is careful not to exaggerate. But it explains why the threat matters now: encrypted data recorded today could be decrypted later, and replacing cryptography across the world's systems takes many years. Post-quantum cryptography develops public-key systems based on problems believed hard even for quantum computers, such as problems on lattices, problems from coding theory, and hash-based signatures whose security rests only on hash functions. NIST ran a multi-year process to select such algorithms and published its first standards in 2024, built on lattice problems and on hash-based signatures. The second edition of the book reflects this progress; first-edition readers should supplement the final chapter with a current summary.
The tradition around it
Serious Cryptography belongs to a line of books that explain cryptography to practitioners, and it is clearest when read against its neighbours on this shelf.
The ancestor of the genre is Applied Cryptography by Bruce Schneier, first published in 1994. That book brought cryptography out of military and academic circles and into the hands of programmers at a moment when the internet was opening. It is encyclopaedic, cataloguing protocols and algorithms with source code. It is also of its era: many of its algorithms are obsolete, and Schneier himself later said that it gave readers the impression that strong algorithms were enough. Cryptography Engineering by Niels Ferguson, Bruce Schneier and Tadayoshi Kohno was partly a response, concentrating on how to build systems correctly and how much can go wrong outside the mathematics. Serious Cryptography continues that correction with updated algorithms and a sharper focus on modern security definitions and common failures.
On the more rigorous side stand Introduction to Modern Cryptography by Jonathan Katz and Yehuda Lindell and the Handbook of Applied Cryptography by Alfred Menezes, Paul van Oorschot and Scott Vanstone. Katz and Lindell teach the game-based definitions and reductions that Serious Cryptography introduces informally; a reader who wants to understand why a mode is secure, not just that it is, should go there next. The Handbook is a dense reference, freely available from its authors, and still valuable for the mathematics of public-key systems though older in its coverage of symmetric designs. A Course in Number Theory and Cryptography by Neal Koblitz, who co-invented elliptic-curve cryptography, supplies the number theory behind RSA and elliptic curves at a level that suits a reader with some mathematics.
The history books on this shelf give context. The Codebreakers by David Kahn is the great history of secret writing up to the computer age. The Code Book by Simon Singh tells the story more briefly and carries it through public-key cryptography. Crypto by Steven Levy narrates how public-key cryptography emerged in the 1970s and how its inventors and advocates fought government restrictions in the 1990s. These books explain why the tools exist; Serious Cryptography explains how they work and fail.
Finally, the blockchain books on this shelf depend on the material here. Mastering Bitcoin and Mastering Ethereum both rely on hash functions, elliptic-curve signatures and key derivation. Bitcoin and Cryptocurrency Technologies by Narayanan and colleagues begins with a chapter of cryptographic background. A reader who has worked through Serious Cryptography will read those books with much better judgement, especially about wallets, signature schemes and the long-term question of quantum resistance.
Questions and criticisms
The book is widely respected, and the fair criticisms concern scope and level rather than accuracy.
Level and audience
Some readers find the mathematics in the public-key chapters too brisk; others find the treatment of security definitions too informal. Both reactions follow from the book's position between popular and academic writing. It does not prove things, and it does not avoid all notation. A reader without any mathematical background will need patience in the middle of the book; a reader with a strong background will want Katz and Lindell for proofs. This is a cost of the book's design, not a flaw in it.
What it leaves out
Some topics are treated briefly or not at all. Zero-knowledge proofs, secure multi-party computation, threshold signatures and other advanced protocols that have become important in blockchain systems receive little attention, especially in the first edition. Key management, the practical problem of storing, rotating and revoking keys, is mentioned more than developed. Side-channel attacks are discussed through examples rather than systematically. Readers interested in these areas need further sources.
What has aged
The first edition was written before TLS 1.3 was finalised and before NIST selected post-quantum standards. Its final chapter therefore describes candidate families rather than chosen algorithms. Its recommendations on specific parameters remain sound in general but should be checked against current guidance. The second edition addresses these points, which is a reason to prefer it if available.
What has held up
The core lessons have held up completely. Authenticated encryption as the default, the danger of nonce reuse, the importance of sound randomness, the preference for misuse-resistant designs, the distinction between primitive strength and system security: each has been confirmed repeatedly by failures since publication. The book's habit of pairing every explanation with how things go wrong is its most durable contribution, because it trains a way of thinking that applies to systems the author never saw.
A broader objection
A more general objection is that books like this can give non-specialists enough confidence to build their own cryptography, which is dangerous. The book is alert to this. It repeatedly advises using established libraries and reviewed designs and consulting experts for anything novel. Its purpose is to make builders better consumers and reviewers of cryptography, not amateur designers. Read in that spirit, it reduces risk rather than increasing it.
Why it is on this shelf
This shelf gathers books on Vedanta, Jyotish, science, economics and technology. In each field we keep the books that teach a discipline of thought, not only a body of facts. Serious Cryptography earns its place in that way.
Cryptography is the technical base of the digital world: of private communication, of online payments, and of every blockchain and digital asset. The bay this book sits in covers the history of codes, the economics of money and the technology of cryptocurrencies. Without the material in this book, those other books can be read only on trust. With it, a reader can check claims about security, understand why a wallet or protocol failed, and see which parts of a new system are sound and which are marketing.
There is also a habit of mind here worth keeping. Cryptography insists on stating assumptions, defining the adversary and asking how a claim could be false. It treats confidence without proof as a risk. It values simplicity because complexity hides errors. These habits apply well beyond computing. They are useful in reading economic arguments, in evaluating technical promises, and in any field where a confident claim needs testing.
Finally, the book is honest about limits. It says plainly that hardness assumptions are assumptions, that quantum computing could change the landscape, and that most failures come from people, not mathematics. A shelf that values calm, exact thinking keeps books that model it.
How to read it
Serious Cryptography rewards slow reading in some parts and quick reading in others. The following plan assumes a reader who programs but is new to the subject.
First pass
- Read the opening chapters on encryption, randomness and security definitions slowly. These set up every later idea. Do not move on until the indistinguishability game and the birthday bound make sense.
- Read the chapters on block ciphers and stream ciphers at moderate pace. Pay most attention to modes of operation and nonces; skim the internal details of cipher designs on first reading.
- Read hash functions, keyed hashing and authenticated encryption carefully. Together they contain the most practically important advice in the book.
- On a first pass, skim the chapter on hard problems if complexity theory is unfamiliar, then read the RSA, Diffie-Hellman and elliptic-curve chapters for their practical lessons, accepting the mathematics on trust where needed.
- Read the TLS and quantum chapters as synthesis. They show how the earlier material is used and what may change.
- Read every section on how things go wrong, even in chapters you skim. These are the heart of the book.
With a pencil
- Work through the birthday bound for 64-bit and 128-bit values and see why one is dangerous and the other is not.
- Run the short code examples in a Python session, and try modifying them: encrypt the same data twice in counter mode with a repeated nonce and combine the ciphertexts.
- Draw the encrypt-then-MAC construction and the alternatives, and mark where an attacker's modified ciphertext is detected in each.
- For ECDSA, write out in symbols why reusing the per-signature secret allows the private key to be computed from two signatures. It takes only a few lines of algebra.
Pace
A chapter every two or three days is a good pace for a reader with a job. The whole book can be read in about six weeks this way, with time to try the examples. A second reading, quicker, after some months, will show how much more the failure sections mean once the concepts have settled.
What to read next from this shelf
For rigour, go to Introduction to Modern Cryptography by Katz and Lindell. For number theory, go to Koblitz. For engineering practice, Cryptography Engineering. For history and motivation, The Code Book and Crypto by Steven Levy. For applications, Mastering Bitcoin, Mastering Ethereum and Bitcoin and Cryptocurrency Technologies, which will now read as applications of familiar tools.
Questions to carry
- For a system you use daily, what can an attacker see, what can they influence, and what would they gain?
- Why must secure encryption be randomised or use a unique nonce, and what exactly goes wrong if it is not?
- When a product says it uses AES-256, what further questions should be asked before trusting it?
- Where does the randomness in a given system come from, and what would happen if it were weaker than assumed?
- Why is the strength of a primitive not the same as the security of a system built from it?
- What is the birthday bound, and where in a design does it set a hidden limit?
- Why is encryption without authentication dangerous even when the key is perfectly secret?
- What does it mean that factoring is hard, and what kind of evidence supports that claim?
- Why do elliptic-curve keys give the same security as much larger RSA keys?
- How could one bad signature reveal a private key, and how do deterministic signature schemes prevent this?
- What did TLS 1.3 gain by removing options, and where else could the same principle apply?
- Which current systems would fail if a large quantum computer appeared, and which would only need longer keys?
- What would it take to migrate a blockchain from elliptic-curve signatures to post-quantum ones?
- When is it right to design something new in cryptography, and when is it right to refuse?
Words to know
- Plaintext and ciphertext: the readable message and its encrypted form.
- Key: the secret value that controls encryption, decryption, signing or authentication.
- Nonce: a number used once, which makes each encryption under the same key different.
- Initialisation vector: a starting value for a mode of operation, often random, that plays a similar role to a nonce.
- Entropy: a measure of unpredictability, the raw material from which secure keys are made.
- Pseudorandom number generator: an algorithm that expands a small random seed into a long stream that looks random.
- Indistinguishability: the security goal that an attacker cannot tell which of two chosen messages was encrypted.
- Bits of security: the base-two logarithm of the work the best known attack needs.
- Birthday bound: the observation that repeats become likely after about the square root of the number of possible values.
- Block cipher: a keyed permutation on fixed-size blocks, such as AES.
- Mode of operation: a rule for applying a block cipher to messages longer than one block, such as CBC or counter mode.
- Stream cipher: an algorithm that produces a keystream from a key and nonce, combined with the plaintext by exclusive-or.
- Hash function: a function that maps any input to a fixed-size digest, ideally resistant to preimages and collisions.
- Collision: two different inputs that produce the same hash digest.
- Length extension: a weakness of some hash constructions that lets an attacker extend a hashed message without knowing its secret prefix.
- MAC: a message authentication code, a keyed tag that proves a message is unaltered and came from a key holder.
- HMAC: a standard construction of a MAC from a hash function.
- Authenticated encryption: encryption that also guarantees integrity, such as AES-GCM or ChaCha20-Poly1305.
- Padding oracle: a flaw in which a system reveals whether decrypted padding is valid, allowing decryption by an attacker.
- Discrete logarithm problem: given a base and a result of repeated multiplication, finding the number of repetitions; the basis of Diffie-Hellman and elliptic-curve systems.
- Forward secrecy: the property that compromise of a long-term key does not reveal past session keys.
- Side channel: information leaked through time, power, sound or other physical effects of computation.
- Post-quantum cryptography: public-key methods designed to resist attack by quantum computers.
A note on this edition
This is a study edition written for this shelf in our own words. It describes and comments on Serious Cryptography by Jean-Philippe Aumasson but does not reproduce its text, its examples or its structure in detail. The book itself is in copyright and is well worth reading in full; it can be found in libraries and bookshops, and the second edition of 2024 is the one to prefer if available. Any errors or simplifications in this companion are ours, not the author's.