Block Cipher Constructions and Pseudorandom Objects

Where pseudorandom permutations come from, in practice and in theory. Practice (Ch. 5): why heuristic block ciphers inside provable modes are sound methodology; block ciphers as PRPs, not encryption schemes; confusion–diffusion and substitution–permutation networks (invertible S-boxes, the avalanche effect, key-recovery attacks on 1- and 2-round SPNs and a distinguisher for 3 rounds); Feistel networks and their inversion; DES (16 rounds, 56-bit key, E-expansion, 6→4 S-boxes), attacks on 1-, 2- and 3-round DES, brute force and the DES challenges, differential and linear cryptanalysis; double encryption and meet-in-the-middle, triple encryption (3DES, EDE); AES (Rijndael, the AES competition, AddRoundKey/SubBytes/ShiftRows/MixColumns, reduced-round attacks, side channels); stream ciphers from block ciphers. Theory (Ch. 6): one-way functions and permutations, families, candidates; hard-core predicates and pitfalls; the Goldreich–Levin theorem in three stages (perfect predictor, 3/4 + 1/p, full proof via pairwise-independent sampling and Chebyshev); the PRG G(s) = (f(s), hc(s)); stretching by the hybrid argument; GGM tree PRFs; Luby–Rackoff Feistel PRPs; one-way functions as necessary and sufficient for private-key cryptography (PRG ⇒ OWF, EAV-secure encryption ⇒ OWF); computational indistinguishability and multi-sample indistinguishability. Exercises worked.

· 33 min read · 6,403 words

Corresponds to Katz & Lindell, Introduction to Modern Cryptography, Chapters 5–6.

Motivation: where does a pseudorandom permutation come from?

IntuitionTwo answers to one question

Every construction in Chapters 3–4 assumed a PRF or PRP. This note answers “do they exist, and how are they built?” twice:

  • In practice (Chapter 5): block ciphers such as DES and AES are heuristic designs with no security proof and no reduction to a simpler problem, trusted because of decades of failed cryptanalysis.
  • In theory (Chapter 6): pseudorandom generators, functions and permutations can be provably built from any one-way function, and one-way functions are also necessary. Private-key cryptography rests on exactly one minimal assumption.

The theoretical constructions are far too inefficient to use. Their value is understanding what security fundamentally requires. (The applied view of these ciphers is in security-in-distributed-systems.)


Part I — Block ciphers in practice (Chapter 5)

ImportantWhy prove things on top of an unproven block cipher?

  1. A PRP is a low-level, simple-to-test target. Checking “looks like a random permutation” is easier than checking “this scheme is CCA-secure”.
  2. It is replaceable. A broken cipher can be swapped for another with the same block length without changing the higher-level scheme’s formats.
  3. Heuristics are confined to one place. Modes, MACs and protocols are proven; designers focus only on building good PRPs.

WarningBlock ciphers are PRPs, not encryption schemes

Despite the name, a block cipher is a building block (strong PRP). AES’s call for submissions explicitly asked how indistinguishable from a random permutation candidates were. Practical ciphers fix one or a few key and block lengths rather than a family indexed by nn. Treat those lengths as the "nn" and require them to be large enough against modern computing.

WarningDon’t design your own

The point is intuition for how ciphers are built, not a recipe. Use standardised, unpatented, heavily analysed ciphers. Seemingly arbitrary design choices are not arbitrary, and the descriptions here are deliberately incomplete and not implementable.

Substitution–permutation networks

DefinitionConfusion and diffusion (Shannon)

A random nn-bit permutation needs an n2nn2^n-bit table: astronomically large for n=128n = 128, versus about 32 Kbit for sixteen random 8-bit tables. So: split the input into small pieces, pass each through a small random-looking function (confusion), then mix the outputs (diffusion), and repeat for several rounds.

Without diffusion, inputs differing in one bit would give outputs differing in one byte, which a random function would never do.

DefinitionSubstitution–permutation network (SPN)

Each round:

  1. key mixing: XOR a round subkey, derived from the master key by the public key schedule;
  2. substitution: apply public S-boxes to small chunks;
  3. permutation: apply a public mixing permutation that reorders bits (here “permutation” means a bit reordering).

Everything except the key is public (Kerckhoffs). Security depends entirely on the choice of S-boxes, mixing and key schedule.

TheoremDesign choice 1 — invertible S-boxes (Claim 5.1)

If every S-box is a bijection, the SPN is efficiently invertible: undo each round backwards (invert the bit permutation, look up the S-box inverse tables, XOR the same subkey), and Fk−1(Fk(x))=xF_k^{-1}(F_k(x)) = x. Purely random S-boxes are not ideal, though: they resist differential and linear cryptanalysis worse than carefully designed ones.

DefinitionDesign choice 2 — the avalanche effect

Small input changes must quickly become large output changes. Two properties suffice:

  1. flipping any one S-box input bit flips at least two of its output bits;
  2. the mixing permutation sends each S-box’s outputs to different S-boxes in the next round.

Then the number of affected bits doubles each round: 2i2^i bits after ii rounds, so a 128-bit block is fully affected after 7 rounds. Random S-boxes don’t guarantee property 1: for a random 4-bit S-box, the chance an output lies within Hamming distance 1 of a given value is 5/16>1/45/16 > 1/4, and with many S-boxes some will fail.

Attacks on reduced-round SPNs

ExampleWhy one, two or three rounds are not enough

  • 1 round (complete break from one known pair): invert the public mixing permutation and S-boxes to get x⊕kx\oplus k, then XOR with xx to get kk.
  • 2 rounds (64-bit block, sixteen 4-bit S-boxes, independent 64-bit round keys ka,kbk^a, k^b): peel off the last round’s mixing and S-boxes. Each 4-bit chunk entering round 2 depends on at most 4 first-round S-boxes, hence only 16 bits of kak^a, plus 4 bits of kbk^b. Guess these 20 bits (2202^{20} options) and check against several known pairs. About 5 pairs leave a unique survivor; with 8, 8⋅220=2238\cdot2^{20} = 2^{23} work per chunk and about 16⋅223=22716\cdot2^{23} = 2^{27} total, instead of 21282^{128}. Lesson: key bits that can be isolated are cheap. Diffusion must make every key bit affect every output bit.
  • 3 rounds (distinguisher): the avalanche isn’t complete, so encrypting two inputs differing in one bit gives outputs with many equal bits.

ExampleVariations (Exercises 5.1–5.3)

  • 8-bit S-boxes: each round-2 S-box can depend on up to 8 first-round S-boxes, i.e. 64 bits of kak^a. With a 64-bit block that is all of kak^a: about 2722^{72} guesses, so isolation largely disappears. With a 128-bit block it is still about 2722^{72} per byte. Larger S-boxes help against this attack more than larger blocks.
  • 3-round SPN in CTR mode: consecutive counters ctr+ictr + i differ in a few low-order bits, so the incomplete avalanche makes the pads correlated, which leaks relations between plaintext blocks. Distinguishability alone is disastrous.
  • Reordering into RR key mixes, then RR substitutions, then RR permutations: XORs of keys collapse to one key, composed S-boxes to one S-box layer, composed permutations to one permutation. It is a one-round SPN, broken as above, whether or not the components differ.

(Worked here.)

Feistel networks

DefinitionFeistel network

Split the input into halves (v1,v2)(v_1, v_2). Each round ii:

(v1,v2) ↦ (v2, v1⊕fi(v2))(v_1, v_2)\ \mapsto\ \big(v_2,\ v_1\oplus f_i(v_2)\big)

The round function fif_i (keyed by a subkey, usually built from S-boxes and mixing) need not be invertible. Invertibility forces structure, which works against the chaos a cipher wants; Feistel avoids this.

TheoremClaim 5.2 — Feistel networks are always invertible

If (αi+1,βi+1)(\alpha_{i+1},\beta_{i+1}) follows (αi,βi)(\alpha_i,\beta_i), then

βi=αi+1,αi=βi+1⊕fi(αi+1)(5.1)\beta_i = \alpha_{i+1},\qquad\alpha_i = \beta_{i+1}\oplus f_i(\alpha_{i+1}) \tag{5.1}

Inversion only evaluates fif_i forwards. Reduced-round attacks on SPNs carry over when ff is built the same way.

DES — the Data Encryption Standard

DefinitionDES at a glance

IBM (with NSA input), US federal standard in 1976. A 16-round Feistel network: 64-bit block, 56-bit key, 48-bit round subkeys chosen by a public schedule (the key is permuted, split into 28-bit halves, and each subkey takes 24 bits from each half). Public initial and final permutations IPIP, IP−1IP^{-1} add no security (they only slow software).

AlgorithmThe DES round function f(x,ki)f(x, k_i)

  1. Expand the 32-bit xx to 48 bits with EE (duplicating half the bits), then XOR with the subkey: E(x)⊕kiE(x)\oplus k_i.
  2. S-boxes: split into eight 6-bit chunks, each through S1,…,S8S_1,\ldots,S_8 with 6-bit input and 4-bit output: the non-invertible confusion step.
  3. Mixing permutation of the 32 output bits: diffusion.

NoteProperties of the DES S-boxes

  1. Each is a 4×164\times16 table of 4-bit entries.
  2. The outer input bits (1 and 6) select the row; bits 2–5 select the column.
  3. Each row is a permutation of 0,…,150,\ldots,15.
  4. Flipping one input bit flips at least two output bits.

They look random but were carefully designed (with NSA help). Random S-boxes, or a random mixing permutation, make DES far easier to break, notably by differential cryptanalysis. Property 4 plus good mixing completes the avalanche by about round 7, well within 16.

Attacks on reduced-round DES

ExampleOne and two rounds — the full key from a few pairs

1 round: y1=x2y_1 = x_2 and y2=x1⊕f1(x2)y_2 = x_1\oplus f_1(x_2), so f1f_1‘s input x2x_2 and output x1⊕y2x_1\oplus y_2 are both known. Undo the mixing permutation to get each S-box’s 4-bit output. Since each row is a permutation, the output fixes the input once the row is chosen: 4 candidate 6-bit inputs per S-box, each giving a candidate subkey chunk (⊕E(x2)\oplus E(x_2)). That leaves 48=2164^8 = 2^{16} candidate subkeys; test them on another pair.

2 rounds: f1f_1 has input x2x_2 and output x1⊕y1x_1\oplus y_1; f2f_2 has input y1y_1 and output x2⊕y2x_2\oplus y_2. Both are fully known, so attack each round as above. This works even with independent round keys.

ExampleThree rounds — meet in the XOR, <230< 2^{30} work

Now no single fif_i has both input and output known. But out(f1)⊕out(f3)=x1⊕y2\mathrm{out}(f_1)\oplus\mathrm{out}(f_3) = x_1\oplus y_2 is known, with inputs x2x_2 to f1f_1 and y1y_1 to f3f_3. Key bits split: the left key half feeds only S1S_1–S4S_4, the right half only S5S_5–S8S_8.

  1. For each of the 2282^{28} left half-keys, compute S1S_1–S4S_4‘s outputs in f1f_1 and f3f_3 and check the 16 corresponding bits of x1⊕y2x_1\oplus y_2. About 2122^{12} survive.
  2. Do the same for the right half.
  3. Brute-force the 2242^{24} combinations.

Total 228+228+224<2302^{28} + 2^{28} + 2^{24} < 2^{30}, easy on a PC. Again: separable key bits are fatal.

Security of DES

WarningThe 56-bit key is DES’s only real weakness

  • Brute force: 2562^{56}; 2552^{55} using the complementation property. Objections to the key length date from the 1970s.
  • RSA’s DES challenges: DESCHALL took 96 days (1997); distributed.net 41 days (early 1998); EFF’s Deep Crack ($250,000) 56 hours (1998); Deep Crack plus distributed.net later 22 h 15 min. DES has long been insecure.
  • Spurious keys: for one (x,y)(x,y) pair, another key also maps x→yx\to y with probability about 256/264=2−82^{56}/2^{64} = 2^{-8}. Rule it out with a second pair.

TheoremThe complementation property and 2552^{55} search (Exercises 5.4–5.5)

DESkˉ(xˉ)=DESk(x)‾\mathrm{DES}_{\bar k}(\bar x) = \overline{\mathrm{DES}_k(x)}. Complementing commutes with bit-duplication in EE, so E(xˉ)⊕kˉ=E(x)⊕kE(\bar x)\oplus\bar k = E(x)\oplus k: identical S-box inputs and ff outputs. Each Feistel half is then (complement) ⊕\oplus (same value), which stays complemented.

Attack: obtain y1=DESK(x)y_1 = \mathrm{DES}_K(x) and y2=DESK(xˉ)y_2 = \mathrm{DES}_K(\bar x). Try one key kk from each complementary pair: if DESk(x)=y1\mathrm{DES}_k(x) = y_1 then K=kK = k; if DESk(x)=y2‾\mathrm{DES}_k(x) = \overline{y_2} then K=kˉK = \bar k. That is 2552^{55} trials. (Worked here.)

ExampleWeak keys and silly variants (Exercises 5.7, 5.10)

  • Weak keys: with k=056k = 0^{56} every subkey is identical, so decryption (subkeys in reverse order) equals encryption: DESk(DESk(x))=x\mathrm{DES}_k(\mathrm{DES}_k(x)) = x, an involution. The same holds for any key whose two 28-bit halves are each constant: all ones, 0281280^{28}1^{28}, 1280281^{28}0^{28}. Four keys in 2562^{56} are no practical threat, but implementations can reject them.
  • S-boxes output zero: f≡0f\equiv0, so each round just swaps halves, and 16 rounds give the identity (up to IPIP). No key dependence at all.
  • ff = identity: (v1,v2)↦(v2,v1⊕v2)(v_1,v_2)\mapsto(v_2,v_1\oplus v_2), a fixed linear map independent of the key.
  • Same subkey every round: decryption equals encryption (up to a final swap), so the cipher is (nearly) an involution, easily distinguished. Identical rounds also enable slide attacks (Biryukov–Wagner), which recover the key with about 2322^{32} known plaintexts.

(Worked here.)

DefinitionAdvanced cryptanalysis

  • Differential cryptanalysis (Biham–Shamir, late 1980s): find input differences Δx=x1⊕x2\Delta x = x_1\oplus x_2 that lead to output differences Δy\Delta y with probability well above 2−n2^{-n}, then use pairs with that difference to isolate and test key portions. It is a chosen-plaintext attack: about 2472^{47} chosen plaintexts against DES. Random S-boxes make DES much weaker, and IBM later confirmed the designers (and NSA) knew the technique and hardened the S-boxes against it, keeping it secret. It completely broke FEAL-8.
  • Linear cryptanalysis (Matsui, early 1990s): find XOR relations xi1⊕⋯⊕yj1⊕⋯=0x_{i_1}\oplus\cdots\oplus y_{j_1}\oplus\cdots = 0 that hold with probability 12+ε\frac12 + \varepsilon. Such a relation alone is a distinguisher with advantage ε\varepsilon; Matsui leverages it to recover keys. It needs only known plaintexts: about 2432^{43} for DES.

Both are impractical against DES (impossible quantities of plaintext), so exhaustive search remains the best practical attack, a tribute to the design. Any new cipher must now show resistance to both.

Increasing the key length

NoteBlack-box constructions over tweaking internals

Changing DES internally (say, a longer key schedule) discards decades of earned confidence. Small changes can destroy security. Instead, compose the unmodified cipher, which also works for any block cipher.

TheoremDouble encryption falls to meet-in-the-middle

Fk1,k2′(x)=Fk2(Fk1(x))F'_{k_1,k_2}(x) = F_{k_2}(F_{k_1}(x)) has a 2n2n-bit key, but given (x,y)(x,y):

  1. list (k~1, Fk~1(x))(\tilde k_1,\ F_{\tilde k_1}(x)) for all k~1\tilde k_1;
  2. list (k~2, Fk~2−1(y))(\tilde k_2,\ F^{-1}_{\tilde k_2}(y)) for all k~2\tilde k_2;
  3. sort both (counting sort, O(2n)O(2^n)) and merge to find matches z1=z2z_1 = z_2 (Exercise 5.8: walk both sorted lists with two pointers, O(N)O(N)).

About 2n2^n candidate pairs remain; test them on a second pair. Time O(2n)O(2^n), space O(2n)O(2^n): barely better than attacking single encryption. Double-DES costs about 2562^{56} (really about 2602^{60}) time and about 2572^{57} memory, too thin a margin, so it is not used.

DefinitionTriple encryption

  • Three keys: Fk3(Fk2−1(Fk1(x)))F_{k_3}\big(F^{-1}_{k_2}(F_{k_1}(x))\big). No weakness known.
  • Two keys: Fk1(Fk2−1(Fk1(x)))F_{k_1}\big(F^{-1}_{k_2}(F_{k_1}(x))\big). There is an attack with 2n2^n time and 2n2^n chosen-plaintext queries, considered unrealistic.

The EDE pattern (F,F−1,FF, F^{-1}, F) gives backward compatibility: equal keys reduce to single encryption. Since F−1F^{-1} is also a PRP, it costs nothing. 3DES replaced DES as the NIST standard in 1999. Its drawbacks are a 64-bit block (birthday problems in modes) and slowness (three DES calls). (NIST has since disallowed 3DES for encryption after 2023.)

AES — the Advanced Encryption Standard

NoteThe AES competition

NIST’s call came in 1997. 15 worldwide submissions led to two public conferences (1998, 1999), 5 finalists, a third conference, and in October 2000 the winner Rijndael (Daemen–Rijmen). Every entrant had motive to break the others (for honour; the winner had to be unpatented), so the world’s best cryptanalysts scrutinised all of them intensively.

DefinitionAES structure

An SPN-like cipher on a 4×44\times4 byte state. Block 128 bits; key 128/192/256 bits; 10/12/14 rounds. (Rijndael allows more sizes; AES is the standardised subset.) Each round:

  1. AddRoundKey: XOR a 16-byte round key, ai,j←ai,j⊕ki,ja_{i,j}\leftarrow a_{i,j}\oplus k_{i,j};
  2. SubBytes: one fixed bijective 8-bit S-box applied to every byte;
  3. ShiftRows: row rr rotated left by r−1r - 1 places;
  4. MixColumns: each column, viewed as a polynomial over GF(28)\mathrm{GF}(2^8), is multiplied by c(x)=3x3+x2+x+2c(x) = 3x^3 + x^2 + x + 2 modulo x4+1x^4 + 1: an invertible linear map.

ShiftRows and MixColumns together act as the (linear, not merely bit-reordering) diffusion layer. The final round omits MixColumns and ends with a key addition, so the last round can’t simply be peeled off.

NoteAES security

The best attacks of the book’s era were on reduced rounds: 6-round AES-128 at about 2722^{72}, 8-round AES-192 at about 21882^{188}, 8-round AES-256 at about 22042^{204}. Nothing better than brute force was known on full AES. (Later “biclique” attacks shave full AES-128 to about 21262^{126}, with no practical impact.) Side-channel attacks (timing, power on smartcards) can extract keys but assume strong physical access. AES is free, standardised, fast and highly secure: the default PRP.

Stream ciphers from block ciphers

NoteUse a block cipher in a streaming mode

Dedicated stream ciphers (for example RC4) are less trusted: there is no long-standing standard without known weaknesses. A block cipher in CTR or OFB mode inherits the cipher’s security. Stream ciphers win only on speed (often about 2×) and on avoiding padding, which rarely matters given how fast AES is.

ExampleDouble-DES as a compression function (Exercise 5.9)

h(x1∥x2)=DESx1(DESx2(064))h(x_1\Vert x_2) = \mathrm{DES}_{x_1}(\mathrm{DES}_{x_2}(0^{64})), mapping 112 bits to 64:

  • (a) An explicit collision: for any weak key ww, DESw(DESw(0))=0\mathrm{DES}_w(\mathrm{DES}_w(0)) = 0. So h(w∥w)=064h(w\Vert w) = 0^{64} for all four weak keys: three collisions for free.
  • (b) Preimages: meet in the middle. Tabulate DESx1−1(y)\mathrm{DES}^{-1}_{x_1}(y) and DESx2(0)\mathrm{DES}_{x_2}(0) and match, at about 2562^{56} time and memory. About 2112−64=2482^{112-64} = 2^{48} preimages exist, so restricting key bits to embed some structure is possible, but not arbitrary meaningful text.
  • (c) Inside Merkle–Damgård: a 64-bit output falls to birthday collisions in about 2322^{32}, and the preimage attack propagates. Unusable.

(Worked here.)


Part II — Theoretical constructions (Chapter 6)

IntuitionThe minimal assumption

Proving PRGs exist unconditionally would require complexity-theory breakthroughs (it implies P ≠ NP), so some assumption is unavoidable. The goal is one that is both necessary and sufficient. That assumption is the existence of one-way functions, minimal for nearly all of cryptography, and intuitively much weaker than “PRFs exist” even though the two turn out to be equivalent.

One-way functions

DefinitionOne-way function (Def. 6.1)

f:{0,1}∗→{0,1}∗f : \{0,1\}^*\to\{0,1\}^* (with input and output lengths polynomially related) is one-way if

  1. easy to compute: a poly-time MfM_f computes ff;
  2. hard to invert: for every ppt A\mathcal A, Pr⁡x←{0,1}n[A(f(x))∈f−1(f(x))]≤negl(n)\Pr_{x\leftarrow\{0,1\}^n}\big[\mathcal A(f(x))\in f^{-1}(f(x))\big]\le\mathrm{negl}(n)

Finding any preimage counts as inverting, not necessarily the original xx.

WarningReading the definition carefully

  • Hardness holds only for uniformly random inputs and large enough nn. A negligible fraction of inputs may be easy.
  • Not one-way means some ppt A\mathcal A inverts with probability at least 1/q(n)1/q(n) for infinitely many nn. An inverter that succeeds with probability n−10n^{-10} on even nn only already breaks one-wayness.
  • Exhaustive search always inverts, so one-wayness is purely a statement about efficient computation.

DefinitionOne-way permutations and families (Defs. 6.2–6.4)

  • One-way permutation: one-way, with each restriction fnf_n to {0,1}n\{0,1\}^n a bijection. f(x)f(x) determines xx, yet xx is computationally hidden.
  • Family (Gen,Samp,f)(\mathrm{Gen},\mathrm{Samp},f): I←Gen(1n)I\leftarrow\mathrm{Gen}(1^n) defines the domain DID_I and range RIR_I; Samp samples DID_I (almost) uniformly; fIf_I is deterministic. It is one-way if the inversion experiment (sample II, xx, give (I,fI(x))(I, f_I(x)), succeed if any preimage is found) has negligible success. A family of permutations has fIf_I bijective on DI=RID_I = R_I.

ExampleCandidates

  • Factoring: fmult(x∥y)=x⋅yf_{\mathrm{mult}}(x\Vert y) = x\cdot y is easy to invert unrestricted (the product almost always has a small factor). Fix it by requiring ∣x∣=∣y∣\lvert x\rvert = \lvert y\rvert, or by using the input to sample two similar-size primes (Chapters 7–8).
  • Subset sum: f(x1,…,xn,J)=(x1,…,xn,∑j∈Jxj)f(x_1,\ldots,x_n,J) = (x_1,\ldots,x_n,\sum_{j\in J}x_j). NP-completeness is worst case; one-wayness needs average-case hardness. Belief rests on the absence of good algorithms, not on NP-hardness.
  • Discrete log: fp(x)=gx mod pf_p(x) = g^x\bmod p, a family of permutations.

Hard-core predicates

DefinitionHard-core predicate (Def. 6.5)

A poly-time predicate hchc such that for every ppt A\mathcal A: Pr⁡x[A(f(x))=hc(x)]≤12+negl(n)\Pr_x[\mathcal A(f(x)) = hc(x)]\le\frac12 + \mathrm{negl}(n). It is one bit of xx that is as good as random given f(x)f(x).

WarningOne-way functions can leak a lot

  • Half the input: g(x1,x2)=(f(x1),x2)g(x_1,x_2) = (f(x_1),x_2) is one-way if ff is, yet reveals half its input. One-wayness only says “not all of xx”.
  • The XOR of all bits isn’t automatically hard-core: g(x)=(f(x),⨁ixi)g(x) = (f(x),\bigoplus_ix_i) is one-way yet outputs that bit. Every fixed predicate fails for some one-way function.
  • Meaningless hard-core bits: g(σ,x)=f(x)g(\sigma,x) = f(x) “hides” σ\sigma because σ\sigma is undetermined, even for non-one-way ff. Useless for PRGs.
  • For 1–1 functions, a hard-core predicate exists only if ff is one-way (Exercise 6.9). Otherwise invert to the unique xx and compute hchc.

ImportantThe roadmap (Theorems 6.6–6.9, Corollary 6.10)

  1. Goldreich–Levin: for any OWF ff, gl(x,r)=⟨x,r⟩ mod 2gl(x,r) = \langle x,r\rangle\bmod2 is hard-core for g(x,r)=(f(x),r)g(x,r) = (f(x),r). It is the XOR of a random subset of xx‘s bits.
  2. One-way permutation + hard-core bit ⇒ PRG stretching by one bit: G(s)=(f(s),hc(s))G(s) = (f(s), hc(s)).
  3. One-bit stretch ⇒ any polynomial stretch (hybrid argument).
  4. Length-doubling PRG ⇒ PRFs (GGM) ⇒ PRPs (Luby–Rackoff).

So one-way permutations give PRGs, PRFs and PRPs. Any one-way function suffices too (Håstad–Impagliazzo–Levin–Luby), but that construction is very involved.

The Goldreich–Levin theorem

TheoremTheorem 6.11 — Goldreich–Levin

If ff is one-way and g(x,r)=(f(x),r)g(x,r) = (f(x),r) with ∣x∣=∣r∣\lvert x\rvert = \lvert r\rvert, then gl(x,r)=⨁ixirigl(x,r) = \bigoplus_ix_ir_i is a hard-core predicate of gg.

Proof strategy: turn any predictor for glgl into an inverter for ff, in three increasingly hard stages.

ProofStage 1: a perfect predictor (Proposition 6.12)

If A\mathcal A always outputs gl(x,r)gl(x,r), query r=eir = e^i: gl(x,ei)=xigl(x,e^i) = x_i. That gives nn queries and all of xx, contradicting one-wayness.

∎

ProofStage 2: success ≥34+1p(n)\ge\frac34 + \frac1{p(n)} (Proposition 6.13)

Key identity: gl(x,r)⊕gl(x,r⊕ei)=xigl(x,r)\oplus gl(x,r\oplus e^i) = x_i for any rr.

Good inputs (Claim 6.14): by averaging, a set SnS_n of at least ε22n\frac\varepsilon2 2^n inputs xx has Pr⁡r[A(f(x),r)=gl(x,r)]≥34+ε2\Pr_r[\mathcal A(f(x),r) = gl(x,r)]\ge\frac34 + \frac\varepsilon2. Otherwise the overall success couldn’t reach 34+ε\frac34 + \varepsilon. Fixing x∈Snx\in S_n leaves only rr random, so repeated trials are independent.

One bit: rr and r⊕eir\oplus e^i are each uniform (not independent). A union bound on failures gives ≤2(14−ε2)=12−ε\le2(\frac14 - \frac\varepsilon2) = \frac12 - \varepsilon, so both answers are right, and xix_i correct, with probability at least 12+ε\frac12 + \varepsilon.

Amplify: take the majority over about n/ε2n/\varepsilon^2 independent rr‘s. Chernoff gives error at most 12n\frac1{2n} per bit. A union bound over nn bits gives all of xx with probability at least 12\frac12 on SnS_n, i.e. overall at least ε/4\varepsilon/4, which is non-negligible.

Why 34\frac34: below that, the two-query union bound gives no advantage.

∎

ProofStage 3: the full theorem, success ≥12+1p(n)\ge\frac12 + \frac1{p(n)} (Proposition 6.16)

Problem: two queries, each right with probability only 12+ε\frac12 + \varepsilon, can’t be combined. Fix: query A\mathcal A only on r⊕eir\oplus e^i and guess gl(x,r)gl(x,r) yourself, for many rr at once, cheaply.

Pairwise-independent rr‘s from few seeds: pick ℓ=⌈log⁡(2n/ε2+1)⌉\ell = \lceil\log(2n/\varepsilon^2 + 1)\rceil uniform seeds s1,…,sℓs^1,\ldots,s^\ell and set rI=⨁i∈Isir^I = \bigoplus_{i\in I}s^i for every nonempty I⊆[ℓ]I\subseteq[\ell]. That gives m=2ℓ−1≈2n/ε2m = 2^\ell - 1\approx2n/\varepsilon^2 strings, each uniform and pairwise independent (for I≠JI\ne J, some seed is in exactly one of them).

Guess only ℓ\ell bits: guess σi=gl(x,si)\sigma^i = gl(x,s^i), all correct with probability 2−ℓ≳ε2/4n2^{-\ell}\gtrsim\varepsilon^2/4n. By linearity, gl(x,rI)=⨁i∈Igl(x,si)gl(x,r^I) = \bigoplus_{i\in I}gl(x,s^i), so all mm guesses τI=⨁i∈Iσi\tau^I = \bigoplus_{i\in I}\sigma^i are then right.

Algorithm A′\mathcal A': for each ii, set viI=τI⊕A(y,rI⊕ei)v^I_i = \tau^I\oplus\mathcal A(y, r^I\oplus e^i) and xi=majorityI(viI)x_i = \mathrm{majority}_I(v^I_i).

Analysis (Claim 6.18): with correct τ\tau‘s and x∈Snx\in S_n, each indicator XI=[viI=xi]X_I = [v^I_i = x_i] has mean at least 12+ε2\frac12 + \frac\varepsilon2, variance below 14\frac14, and the XIX_I are pairwise independent. By pairwise-independent Chebyshev, Pr⁡[majority wrong]≤Var(ε/2)2m<12n\Pr[\text{majority wrong}]\le\frac{\mathrm{Var}}{(\varepsilon/2)^2m} < \frac1{2n}. A union bound over bits gives xx correct with probability at least 12\frac12.

Total: ε2⋅ε24n⋅12=ε316n\frac\varepsilon2\cdot\frac{\varepsilon^2}{4n}\cdot\frac12 = \frac{\varepsilon^3}{16n}, which is non-negligible. This contradicts one-wayness.

∎

FormulaTools: Markov, Chebyshev, pairwise sampling

  • Markov: X≥0⇒Pr⁡[X≥v]≤E[X]/vX\ge0\Rightarrow\Pr[X\ge v]\le\mathbb E[X]/v.
  • Chebyshev: Pr⁡[∣X−EX∣≥δ]≤Var(X)/δ2\Pr[\lvert X - \mathbb EX\rvert\ge\delta]\le\mathrm{Var}(X)/\delta^2 (Markov applied to (X−EX)2(X - \mathbb EX)^2).
  • Pairwise-independent sampling (Corollary 6.15): for mm pairwise-independent variables with mean μ\mu and variance σ2\sigma^2, variances add (zero covariances), so Pr⁡[∣1m∑Xi−μ∣≥ε]≤σ2ε2m\Pr\Big[\Big\lvert\frac1m\sum X_i - \mu\Big\rvert\ge\varepsilon\Big]\le\frac{\sigma^2}{\varepsilon^2m}

Weaker than Chernoff’s exponential tail, but it needs only pairwise independence, which is exactly what the subset-XOR trick supplies. (Compare the classical inequalities in concentration-of-measure-for-bandits.)

Pseudorandom generators from one-way permutations

TheoremTheorem 6.19 — One bit of stretch

If ff is a one-way permutation with hard-core predicate hchc, then G(s)=(f(s),hc(s))G(s) = (f(s), hc(s)) is a PRG with ℓ(n)=n+1\ell(n) = n + 1. f(s)f(s) is uniform because ff is a permutation, and hc(s)hc(s) looks uniform given f(s)f(s).

ProofDistinguisher ⇒ predictor

Suppose DD distinguishes (f(s),hc(s))(f(s),hc(s)) from uniform (n+1)(n+1)-bit strings with advantage ε\varepsilon. Uniform is the same as (f(s),β)(f(s),\beta) for a random bit β\beta, which is half (f(s),hc(s))(f(s),hc(s)) and half (f(s),hc(s)‾)(f(s),\overline{hc(s)}). So DD separates (f(s),hc(s))(f(s),hc(s)) from (f(s),hc(s)‾)(f(s),\overline{hc(s)}) with advantage 2ε2\varepsilon; say it outputs 1 more often on the former.

Predictor A(y)\mathcal A(y): pick a random σ\sigma, run D(y,σ)D(y,\sigma), and output σ\sigma if DD says 1, else σˉ\bar\sigma. Then

Pr⁡[A=hc]=12Pr⁡[D(f,hc)=1]+12(1−Pr⁡[D(f,hc‾)=1])=12+12⋅2ε\Pr[\mathcal A = hc] = \tfrac12\Pr[D(f,hc) = 1] + \tfrac12\big(1 - \Pr[D(f,\overline{hc}) = 1]\big) = \tfrac12 + \tfrac12\cdot2\varepsilon

contradicting hchc being hard-core.

∎

WarningWhy stretching even by one bit is remarkable

A deterministic algorithm creates a bit of (pseudo)randomness. That is impossible against unbounded observers. It is possible only because the observer is computationally bounded.

TheoremTheorem 6.20 — Any polynomial stretch

From G1G_1 with ℓ1(n)=n+1\ell_1(n) = n + 1: let s0=ss_0 = s; for i=1,…,p(n)i = 1,\ldots,p(n) set (si,σi)=G1(si−1)(s_i,\sigma_i) = G_1(s_{i-1}); output σ1⋯σp(n)\sigma_1\cdots\sigma_{p(n)}. Output one bit and reseed with the other nn.

ProofThe hybrid argument

Hybrids: HiH^i is ii truly random bits followed by p(n)−ip(n) - i bits generated from a fresh random seed. H0=G(s)H^0 = G(s) and Hp(n)H^{p(n)} is uniform.

Distinguisher D′D' for G1G_1, given w∈{0,1}n+1w\in\{0,1\}^{n+1}: pick i←{0,…,p−1}i\leftarrow\{0,\ldots,p - 1\}; output ii random bits, then ww‘s last bit, then the generator’s output from seed w[n]w_{[n]}; run DD on the result.

  • If w=G1(s)w = G_1(s), this is exactly HiH^i.
  • If ww is uniform, it is exactly Hi+1H^{i+1}.

The sum telescopes:

∣Pr⁡[D′(G1(s))=1]−Pr⁡[D′(r)=1]∣=1p(n)∣Pr⁡[D(H0)=1]−Pr⁡[D(Hp)=1]∣=ε(n)p(n)\big\lvert\Pr[D'(G_1(s)) = 1] - \Pr[D'(r) = 1]\big\rvert = \frac1{p(n)}\big\lvert\Pr[D(H^0) = 1] - \Pr[D(H^p) = 1]\big\rvert = \frac{\varepsilon(n)}{p(n)}

which is non-negligible: a contradiction.

∎

ImportantThe hybrid technique

Three ingredients: (1) the extreme hybrids are the two distributions to be compared; (2) neighbouring hybrids differ in one use of the primitive, so distinguishing them breaks it; (3) there are polynomially many hybrids, so the advantage drops only by a factor 1/p1/p. Running DD on inputs it “doesn’t expect” is fine: it is just an algorithm.

NoteBlum–Micali generator and the stream-cipher analogy

Unrolling with G1(s)=(f(s),hc(s))G_1(s) = (f(s), hc(s)) and also outputting the final state gives the explicit PRG (fp(n)(s), hc(s),hc(f(s)),…)\big(f^{p(n)}(s),\ hc(s), hc(f(s)),\ldots\big): iterate the permutation and emit a hard-core bit per step. Practical stream ciphers likewise keep a large secret internal state, output a few bits per step and update the state. The theory suggests this heuristic is sound.

Pseudorandom functions: the GGM construction

IntuitionFrom strings to functions via a tree

A random function on {0,1}n\{0,1\}^n is a 2n⋅n2^n\cdot n-bit table, too long to generate. For a 1-bit input, Fk(b)=Gb(k)F_k(b) = G_b(k) (halves of a length-doubling PRG) works directly. For 2 bits, apply GG twice: Fk(x1x2)=Gx2(Gx1(k))F_k(x_1x_2) = G_{x_2}(G_{x_1}(k)). The four leaves are pseudorandom (hybrid: replace G0(k),G1(k)G_0(k), G_1(k) by independent uniform seeds, then apply PRG security to each). Extend to depth nn.

AlgorithmGGM construction (Construction 6.21; Goldreich–Goldwasser–Micali)

With G(s)=(G0(s),G1(s))G(s) = (G_0(s), G_1(s)) a length-doubling PRG:

Fk(x1⋯xn)=Gxn(⋯Gx2(Gx1(k))⋯)F_k(x_1\cdots x_n) = G_{x_n}\big(\cdots G_{x_2}(G_{x_1}(k))\cdots\big)

A complete binary tree of depth nn has the root labelled kk and children G0,G1G_0, G_1 of their parent. The input is a root-to-leaf path and the output is the leaf label. Evaluation costs nn PRG calls; the exponential tree is never built. Internal nodes must not be output: an internal label determines its whole subtree, so revealing it would break pseudorandomness.

TheoremTheorem 6.22 — GGM is a PRF

If GG is a length-doubling PRG, Construction 6.21 is an efficiently computable PRF.

ProofSketch: hybrids over tree levels, filled lazily

HiH^i: levels 0..i0..i have independent uniform labels and lower levels are computed by GG. H0H^0 is GGM and HnH^n is a random function, so some neighbouring pair is distinguished with advantage at least ε/n\varepsilon/n.

The full level i+1i+1 is exponential, so the reduction D′D' fills the tree lazily. It receives t(n)t(n) samples (one per possible query), each either G(s)G(s) for fresh seeds or uniform 2n2n-bit strings. Picking a random ii, it labels the children of each newly reached level-ii node with the next sample, and answers repeated paths consistently. Pseudorandom samples give HiH^i; uniform samples give Hi+1H^{i+1}. Many samples of GG are jointly pseudorandom (multi-sample theorem below), contradicting PRG security.

∎

Pseudorandom permutations: Luby–Rackoff

TheoremTheorem 6.24 — Four-round Feistel with PRF round functions is a strong PRP

With independent keys k1,…,k4k_1,\ldots,k_4 for an nn-bit PRF FF, the 4-round Feistel network with round functions FkiF_{k_i} is a strong PRP on 2n2n bits with a 4n4n-bit key: efficiently computable, efficiently invertible (Claim 5.2), and indistinguishable from a random permutation even given the inverse oracle. Three rounds give a PRP secure against forward queries only. (Proof not given.) A beautiful link between practice (DES is Feistel) and theory.

ExampleWhy fewer rounds fail

  • 1 round: the output’s left half equals x2x_2, the input’s right half.
  • 2 rounds: query (x1,x2)(x_1,x_2) and (x1′,x2)(x'_1,x_2) with the same right half. The left halves of the outputs satisfy y1⊕y1′=x1⊕x1′y_1\oplus y'_1 = x_1\oplus x'_1, which holds with probability 1, versus 2−n2^{-n} for random.
  • 3 rounds with an inverse oracle: there is a known distinguisher using a mix of forward and backward queries, which is why strong PRPs need 4.

(First two worked here.)


One-way functions are necessary and sufficient

TheoremTheorems 6.25–6.26 — Sufficiency

If one-way functions exist, then PRGs, PRFs and PRPs exist (HILL plus GGM plus Luby–Rackoff). Hence CCA-secure private-key encryption and existentially unforgeable MACs exist (Chapters 3–4).

TheoremProposition 6.27 — PRGs (and PRFs) imply one-way functions

PRFs give PRGs via G(s)=Fs(0)∥Fs(1)G(s) = F_s(0)\Vert F_s(1). Given a length-doubling PRG GG, set f(x)=G(x)f(x) = G(x). An inverter becomes a distinguisher: on input ww, run the inverter and output 1 iff it returns xx with G(x)=wG(x) = w.

  • On G(s)G(s): success ≥ε(n)\ge\varepsilon(n).
  • On uniform ww: ww is in GG‘s range with probability at most 2n/22n=2−n2^n/2^{2n} = 2^{-n}, so success ≤2−n\le2^{-n}.

The advantage ε−2−n\varepsilon - 2^{-n} is non-negligible: a contradiction.

TheoremProposition 6.28 — EAV-secure encryption implies one-way functions

Perfectly secret schemes exist without assumptions (keys at least as long as messages), so the argument must use messages longer than keys. Define

f(k,m,r)=(Enck(m;r), m),∣m∣=2∣k∣f(k,m,r) = (\mathrm{Enc}_k(m;r),\ m),\qquad\lvert m\rvert = 2\lvert k\rvert

ProofInverter ⇒ eavesdropper

A′\mathcal A': choose random m0,m1m_0, m_1 of length 2n/52n/5, receive c=Enck(mb)c = \mathrm{Enc}_k(m_b), run the inverter on (c,m0)(c,m_0). If it returns (k′,m0,r′)(k',m_0,r') with Enck′(m0;r′)=c\mathrm{Enc}_{k'}(m_0;r') = c, output 0; else guess at random.

  • b=0b = 0: the inverter succeeds with probability at least ε\varepsilon, so Pr⁡[win]≥12+ε2\Pr[\text{win}]\ge\frac12 + \frac\varepsilon2.
  • b=1b = 1: success requires some key k′k' with Deck′(c)=m0\mathrm{Dec}_{k'}(c) = m_0. By a union bound over 2n/52^{n/5} keys and the independent uniform m0m_0 of 2n/52n/5 bits, this has probability at most 2n/5/22n/5=2−n/52^{n/5}/2^{2n/5} = 2^{-n/5}. So Pr⁡[win]≥12−122−n/5\Pr[\text{win}]\ge\frac12 - \frac12 2^{-n/5}.

Overall 12+ε4−142−n/5\frac12 + \frac\varepsilon4 - \frac14 2^{-n/5}, a non-negligible advantage. The bound needs plaintext longer than key; it fails for one-time-pad-like schemes.

∎

TheoremProposition 6.29 — Secure MACs imply one-way functions

Stated without proof. It is subtle because unconditionally secure MACs exist when the number of authenticated messages is bounded relative to the key length.

ImportantPrivate-key cryptography ⟺ one-way functions

One-way functions are necessary and sufficient for PRGs, PRFs, PRPs, secure private-key encryption and MACs: a single, minimal assumption. Public-key cryptography appears to need more: one-way functions are necessary but are not believed sufficient, with evidence that black-box constructions from them are unlikely (Impagliazzo–Rudich).

Computational indistinguishability

DefinitionEnsembles and computational indistinguishability (Defs. 6.30–6.31)

A probability ensemble is a sequence of distributions X={Xn}X = \{X_n\}, one per security parameter (finite distributions alone would be trivially distinguishable by hard-wiring them). X≡cYX\overset c\equiv Y if for every ppt DD (given 1n1^n),

∣Pr⁡[D(Xn)=1]−Pr⁡[D(Yn)=1]∣≤negl(n)\big\lvert\Pr[D(X_n) = 1] - \Pr[D(Y_n) = 1]\big\rvert\le\mathrm{negl}(n)

NotePseudorandomness is a special case (Defs. 6.32–6.33)

  • XX is pseudorandom if X≡cUℓ(n)X\overset c\equiv U_{\ell(n)}.
  • A PRG is an expanding GG with {G(Un)}\{G(U_n)\} pseudorandom.
  • Likewise DDH is (G,g,gx,gy,gxy)≡c(G,g,gx,gy,gz)(\mathbb G,g,g^x,g^y,g^{xy})\overset c\equiv(\mathbb G,g,g^x,g^y,g^z), and quadratic residuosity is “residues ≈ non-residues”, over non-numeric index sets.
  • Computational indistinguishability is the computational relaxation of equal distributions, exactly as indistinguishable encryption relaxes perfect secrecy.

TheoremTheorem 6.34 — Many samples stay indistinguishable

If X≡cYX\overset c\equiv Y are efficiently samplable, then p(n)p(n) independent samples of XX are indistinguishable from p(n)p(n) samples of YY.

ProofHybrid over sample positions

Hi=(X(1),…,X(i),Y(i+1),…,Y(p))H^i = (X^{(1)},\ldots,X^{(i)},Y^{(i+1)},\ldots,Y^{(p)}), with H0=YˉH^0 = \bar Y and Hp=XˉH^p = \bar X. D′D', given one sample α\alpha, picks a random ii, samples ii copies of XX and p−i−1p - i - 1 of YY itself (this is where efficient samplability is needed), and places α\alpha at position i+1i + 1. If α∼X\alpha\sim X it gets Hi+1H^{i+1}; if α∼Y\alpha\sim Y, HiH^i. Telescoping gives advantage ε/p\varepsilon/p. Example: (G(s1),G(s2))(G(s_1),G(s_2)) is a pseudorandom 2ℓ2\ell-bit string, as used in the GGM proof.

∎


Quick reference

ObjectStatementNote
Methodologyheuristic PRP + proven modeslow-level, replaceable, one heuristic
SPNXOR subkey → S-boxes → mix, repeatedS-boxes must be bijective
Avalanche≥2-bit S-box change + spreading ⇒ 2i2^i bits after ii rounds7 rounds for 128 bits
Reduced SPN1 round: key from one pair; 2 rounds: ≈227\approx2^{27}; 3 rounds: distinguisherisolated key bits are fatal
Feistel(v1,v2)↦(v2,v1⊕f(v2))(v_1,v_2)\mapsto(v_2,v_1\oplus f(v_2))invertible for any ff
DES16-round Feistel, 64-bit block, 56-bit key, EE + 6→4 S-boxeswell designed, key too short
Reduced DES1–2 rounds: 2162^{16} candidates; 3 rounds: <230<2^{30}halves of the key separate
DES brute force2552^{55} (complementation)Deep Crack: 56 hours
Diff. / linear2472^{47} chosen / 2432^{43} knownimpractical against DES
Double encryptionmeet in the middle: 2n2^n time and memorydouble-DES unused
Triple encryptionEDE; 3 keys secure, 2 keys only weak to 2n2^n chosen queries3DES (64-bit block)
AESSPN on 4×44\times4 bytes; 10/12/14 roundsthe default PRP
OWFeasy to compute, inverted with negligible probability on random inputfactoring, subset sum, DLog
Hard-corehc(x)hc(x) unpredictable from f(x)f(x)no universal fixed predicate
Goldreich–Levin⟨x,r⟩\langle x,r\rangle hard-core for (f(x),r)(f(x),r)pairwise sampling + Chebyshev
PRG from OWP(f(s),hc(s))(f(s),hc(s)); iterate for any stretchBlum–Micali
Hybrid argumentextremes, neighbours, polynomially manyadvantage /p/p
GGMFk(x)=Gxn(⋯Gx1(k))F_k(x) = G_{x_n}(\cdots G_{x_1}(k))leaves only
Luby–Rackoff4-round PRF Feistel = strong PRP; 3 rounds = PRP
MinimalityOWF ⟺ PRG ⟺ PRF ⟺ private-key encryption and MACspublic key needs more
Indistinguishability∣Pr⁡[D(Xn)]−Pr⁡[D(Yn)]∣≤negl\lvert\Pr[D(X_n)] - \Pr[D(Y_n)]\rvert\le\mathrm{negl}multi-sample via hybrids

Facts to keep to hand

  • Practical block ciphers are heuristic PRPs built from confusion and diffusion. SPNs (AES) need invertible S-boxes; Feistel networks (DES) don’t. Security comes from careful S-boxes, mixing, enough rounds for full avalanche, and inseparable key bits. Reduced-round attacks show exactly what fails without each.
  • DES failed only on key length; the fixes are black-box. Its design withstood differential and linear cryptanalysis. Double encryption falls to meet-in-the-middle; 3DES works but is slow with small blocks; AES, chosen by open competition, is the standard.
  • In theory, everything comes from one-way functions. Goldreich–Levin extracts a hard-core bit from any OWF, a one-way permutation plus that bit stretches by one, the hybrid argument stretches arbitrarily, GGM trees give PRFs, and four Feistel rounds give PRPs.
  • And one-way functions are unavoidable. PRGs, eavesdropper-secure encryption with messages longer than keys, and MACs all imply OWFs, so OWFs are the minimal assumption for private-key cryptography. Computational indistinguishability and hybrid arguments are the common language of all these proofs.

References

  • Katz & Lindell, Introduction to Modern Cryptography — Chapters 5–6
  • Goldreich, Foundations of Cryptography, Vol. 1 (2001) — Chapters 2–3
  • Goldreich & Levin, “A Hard-Core Predicate for All One-Way Functions” (1989)
  • Luby & Rackoff, “How to Construct Pseudorandom Permutations from Pseudorandom Functions” (1988)
  • Daemen & Rijmen, The Design of Rijndael (2002)

← All notes