Feistel networks and the Luby–Rackoff theorem #
A Feistel round ([BS23], Section 4.5; [LR88]) turns an arbitrary function
f : G → G on an additive group G into a bijection feistelRoundEquiv f : G × G ≃ G × G mapping
(L, R) to (R, L + f R) with explicit inverse (L', R') ↦ (R' - f L', L') requiring no
invertibility of f. Composing a list of round functions yields the multi-round Feistel cipher
feistelNetwork, specialized to the three-round (feistel3) and four-round (feistel4) networks.
Over any group of exponent two (∀ x : G, -x = x, including BitString n), swapping the two
halves (Equiv.prodComm G G) conjugates feistelNetwork fs.reverse to the inverse cipher
(feistelNetwork fs).symm.
We prove the Luby–Rackoff theorem ([BS23], Section 4.5, Theorem 4.9; [LR88]):
- Information-theoretic core with Δ-universal Round 1: when the first round function is drawn
from an
ε-almost-Δ-universal family (IsDeltaUniversalHash seed₁ h₁ ε) and the second and third round functions are independent uniform random functions onG, any adaptive adversaryprogram : OracleComp (fun _ : G × G => G × G) Boolmaking at mostQqueries (IsQueryBounded program Q) distinguishes the three-round Feistel network from a uniform random function onG × Gwith advantage at most $$\binom{Q}{2} \cdot \varepsilon + \binom{Q}{2} \cdot \frac{1}{|G|}$$ (advantage_feistel3HashIdealGame_randomFunctionGame_le). - Classical three-round information-theoretic bound: a uniform random function on
Gis|G|⁻¹-Δ-universal (isDeltaUniversalHash_uniformOfFintype), so three independent uniform random round functions have distinguishing advantage against a uniform random function onG × Gat most $$\frac{2 \binom{Q}{2}}{|G|} = \frac{Q (Q - 1)}{|G|}$$ (advantage_feistel3RandomRoundsGame_randomFunctionGame_le). - Computational PRF-to-Feistel hybrid reductions (3-round and 4-round) and PRP switching:
replacing keyed round functions
F kᵢwith independent uniform random round functions adds at most the sum of the single-round PRF advantages (advantage_feistel3KeyedGame_feistel3RandomRoundsGame_le,advantage_feistel3KeyedGame_randomFunctionGame_le, and the four-round bidirectional chosen-ciphertext hybrid boundadvantage_feistel4StrongKeyedGame_feistel4StrongRandomRoundsGame_le). Combining with the PRP/PRF switching bound onG × G(advantage_idealPermGame_randomFunctionGame_le) yields the pseudorandom-permutation bounds againstidealPermGame(advantage_feistel3HashIdealGame_idealPermGame_le,advantage_feistel3RandomRoundsGame_idealPermGame_le,advantage_feistel3KeyedGame_idealPermGame_le). - Three-round chosen-ciphertext separation ([BS23], Section 4.1.3 and
Exercise 4.15(b)): with two forward
encryption queries and one inverse decryption query, the explicit distinguisher
feistel3CCAAttackaccepts any three-round Feistel network with probability1(eval_feistel3_feistel3CCAAttack). Whenl₀ = l₁, the third query asks to invert the first ciphertext, so every bidirectional permutation (feistelStrongOracle π) andidealStrongGamealso accept with probability1(eval_feistelStrongOracle_feistel3CCAAttack_self,idealStrongGame_feistel3CCAAttack_self,advantage_feistel3CCAAttack_self). Wheneverl₀ ≠ l₁, couplingidealStrongGamewith the forgetful bidirectional lazy sampler shows thatidealStrongGameacceptsfeistel3CCAAttack l₀ l₁ r₀with probability at most|G|⁻¹ + 4 * |G × G|⁻¹(idealStrongGame_feistel3CCAAttack_true_le), giving the quantitative nonnegligible chosen-ciphertext advantage lower bound1 - |G|⁻¹ - 4 * |G|⁻¹ ^ 2againstidealStrongGame(le_advantage_feistel3CCAAttack_idealStrongGame_of_ne). In addition, whenGhas three distinct elementsl₀, l₁, l₂(|G| ≥ 3), the transpositionEquiv.swap (l₀, (l₁ - l₀) + r₀) (l₂, r₀)is rejected deterministically (eval_feistelStrongOracle_swap_feistel3CCAAttack_eq_false,le_advantage_feistel3CCAAttack_idealStrongGame,advantage_feistel3CCAAttack_idealStrongGame_pos), and against the independent-table bidirectional benchmarkindependentTableStrongGame,feistel3CCAAttack l₀ l₁ r₀accepts with probability|G|⁻¹and has exact advantage1 - |G|⁻¹(eval_independentTableStrongGame_feistel3CCAAttack,advantage_feistel3CCAAttack_independentTable). - Four-round strong PRP Luby–Rackoff theorem ([LR88]; see [BS23],
Section 4.1.3 for strongly secure block ciphers): when all four round functions
f₁, f₂, f₃, f₄ : G → Gare independent uniform random functions, coupling the inner roundsf₂, f₃to the forgetful bidirectional lazy sampler onG × Gand bounding outer-round collisions forf₁(Round 1) and-f₄(Round 4 on the swapped cache) shows that anyQ-query adaptive chosen-ciphertext distinguisher has advantage againstidealStrongGameat most $$2 \binom{Q}{2} \cdot \frac{1}{|G|} + 2 \binom{Q}{2} \cdot \frac{1}{|G|^2}$$ (with the concrete constant coming from this proof;feistel4StrongRandomRoundsGame_apply_le,idealStrongGame_apply_le_feistel4StrongRandomRoundsGame,advantage_feistel4StrongRandomRoundsGame_idealStrongGame_le,advantage_feistel4StrongRandomRoundsGame_bitString_le). Combined with the four-round PRF hybrid reduction, this gives the full four-round strong PRP theoremadvantage_feistel4StrongKeyedGame_idealStrongGame_le.
Main definitions #
Cslib.Crypto.LubyRackoff.feistelRound,feistelInvRound,feistelRoundEquiv: single Feistel round and its bundled equivalence over[AddGroup G].Cslib.Crypto.LubyRackoff.feistelNetwork,feistel3,feistel4: multi-round, 3-round, and 4-round Feistel permutations.Cslib.Crypto.LubyRackoff.feistel3FixedGame,feistel3HashIdealGame,feistel3RandomRoundsGame,feistel3KeyedGame,randomFunctionGame,idealPermGame: 3-round Feistel, ideal random-function, and ideal random-permutation games.Cslib.Crypto.LubyRackoff.feistelStrongOracle,idealStrongGame,independentTableStrongGame,feistel4StrongKeyedGame,feistel4StrongRandomRoundsGame,feistel3CCAAttack: bidirectional (forward + inverse) oracle games and the 3-query CCA attack on 3-round Feistel.
Main results #
Cslib.Crypto.LubyRackoff.prodComm_trans_feistelNetwork_reverse_trans_prodComm: swap-reversal conjugation identity for Feistel decryption over groups of exponent two.Cslib.Probability.isDeltaUniversalHash_uniformOfFintype,Cslib.Probability.isDeltaUniversalHash_neg_uniformOfFintype: a uniform random function intoGand its negation are|G|⁻¹-Δ-universal.Cslib.Crypto.LubyRackoff.feistel3HashIdealGame_apply_le,Cslib.Crypto.LubyRackoff.randomFunctionGame_apply_le_feistel3HashIdealGame: two-sided probability comparisons for 3-round Luby–Rackoff with Δ-universal Round 1.Cslib.Crypto.LubyRackoff.advantage_feistel3HashIdealGame_randomFunctionGame_le,Cslib.Crypto.LubyRackoff.advantage_feistel3HashIdealGame_idealPermGame_le: 3-round Luby–Rackoff bounds with Δ-universal Round 1 againstrandomFunctionGameandidealPermGame.Cslib.Crypto.LubyRackoff.advantage_feistel3RandomRoundsGame_randomFunctionGame_le,Cslib.Crypto.LubyRackoff.advantage_feistel3RandomRoundsGame_idealPermGame_le: 3-round Luby–Rackoff bounds with three uniform random round functions.Cslib.Crypto.LubyRackoff.advantage_feistel3KeyedGame_randomFunctionGame_le,Cslib.Crypto.LubyRackoff.advantage_feistel3KeyedGame_idealPermGame_le: Boneh–Shoup Theorem 4.9 combining the 3-round PRF hybrid reduction with the information-theoretic PRF and PRP bounds.Cslib.Crypto.LubyRackoff.advantage_feistel4StrongKeyedGame_feistel4StrongRandomRoundsGame_le,Cslib.Crypto.LubyRackoff.feistel4StrongRandomRoundsGame_apply_le,Cslib.Crypto.LubyRackoff.idealStrongGame_apply_le_feistel4StrongRandomRoundsGame,Cslib.Crypto.LubyRackoff.advantage_feistel4StrongRandomRoundsGame_idealStrongGame_le,Cslib.Crypto.LubyRackoff.advantage_feistel4StrongKeyedGame_idealStrongGame_le,Cslib.Crypto.LubyRackoff.advantage_feistel4StrongRandomRoundsGame_bitString_le: 4-round bidirectional PRF hybrid reduction, information-theoretic random-round collision bound, and full 4-round strong PRP Luby–Rackoff theorem.Cslib.Crypto.LubyRackoff.eval_feistel3_feistel3CCAAttack,Cslib.Crypto.LubyRackoff.advantage_feistel3CCAAttack_self,Cslib.Crypto.LubyRackoff.idealStrongGame_feistel3CCAAttack_true_le,Cslib.Crypto.LubyRackoff.le_advantage_feistel3CCAAttack_idealStrongGame_of_ne,Cslib.Crypto.LubyRackoff.le_advantage_feistel3CCAAttack_idealStrongGame,Cslib.Crypto.LubyRackoff.advantage_feistel3CCAAttack_independentTable: the 3-query CCA distinguisher against 3-round Feistel.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, Sections 4.1.3 and 4.5 (Theorem 4.9 and Exercise 4.15(b)).
- M. Luby, C. Rackoff, How to Construct Pseudorandom Permutations from Pseudorandom Functions.
Algebraic Feistel permutations #
Over any group of exponent two (∀ x : G, -x = x), swapping the two halves conjugates one
Feistel round to its inverse.
Over any group of exponent two (∀ x : G, -x = x), Feistel decryption is Feistel encryption
with the round functions in reverse order, conjugated by swapping the two halves.
The 3-round Luby–Rackoff theorem #
The 3-round Feistel game with a fixed first round function f₁ and independent uniform random
second and third round functions f₂, f₃ : G → G.
Instances For
The 3-round Feistel game where the first round function is drawn from a keyed hash family
(seed₁, h₁) and the second and third round functions are independent uniform random functions.
Instances For
The 3-round Feistel game with three independent uniform random round functions
f₁, f₂, f₃ : G → G.
Instances For
The ideal random-function game on G × G: sample a uniform table (G × G) → (G × G) and
answer every query from it.
Instances For
The ideal random-permutation game on G × G: sample a uniform permutation
π ← PMF.uniformOfFintype (Equiv.Perm (G × G)) and answer every query via π p.
Instances For
3-round Luby–Rackoff theorem in ℝ≥0∞ (with Δ-universal Round 1): for any adaptive
program making at most Q queries, feistel3HashIdealGame accepts with probability at most
randomFunctionGame plus Q.choose 2 * ε + Q.choose 2 * |G|⁻¹.
Reverse inequality for the 3-round Luby–Rackoff bound with Δ-universal Round 1:
randomFunctionGame accept probability is bounded by feistel3HashIdealGame plus the collision
term.
3-round Luby–Rackoff theorem with Δ-universal Round 1 ([BS23], Section 4.5.1;
[LR88]): when Round 1 is drawn from an ε-almost-Δ-universal hash family and Rounds 2
and 3 are independent uniform random functions on G, any Q-query adaptive adversary has
distinguishing advantage against a uniform random function on G × G at most
Q.choose 2 * ε.toReal + Q.choose 2 / |G|.
Classical 3-round Luby–Rackoff theorem ([BS23], Section 4.5, Theorem 4.9;
[LR88]):
three Feistel rounds with independent uniform random round functions on G are indistinguishable
from a uniform random function on G × G up to 2 * Q.choose 2 / |G| = Q * (Q - 1) / |G| for any
Q-query adaptive adversary.
PRP/PRF switching bound on G × G: for any Q-query adaptive adversary, idealPermGame
and randomFunctionGame have distinguishing advantage at most Q.choose 2 / |G| ^ 2.
3-round Luby–Rackoff PRP bound with Δ-universal Round 1: against a uniform random
permutation on G × G (idealPermGame), the distinguishing advantage of a Q-query adversary is
at most Q.choose 2 * ε.toReal + Q.choose 2 / |G| + Q.choose 2 / |G| ^ 2.
Classical 3-round Luby–Rackoff PRP bound: three Feistel rounds with independent uniform
random round functions on G are indistinguishable from a uniform random permutation on G × G
(idealPermGame) up to 2 * Q.choose 2 / |G| + Q.choose 2 / |G| ^ 2.
3-round PRF-to-Feistel hybrid reductions (Boneh–Shoup Theorem 4.9) #
Single-round PRF real game: sample k ← keyGen and answer queries with F k.
Instances For
Single-round PRF ideal game: sample a uniform random function f : G → G.
Instances For
The 3-round Feistel game with three independent keyed round functions F k₁, F k₂, F k₃.
Instances For
Round-1 PRF reduction distinguisher for fixed f₂, f₃ : G → G.
Instances For
Round-2 PRF reduction distinguisher for fixed f₁, f₃ : G → G.
Instances For
Round-3 PRF reduction distinguisher for fixed f₁, f₂ : G → G.
Instances For
Replacing the three keyed round functions F k₁, F k₂, F k₃ with independent uniform random
round functions adds at most the sum of the three single-round PRF advantages.
The Luby–Rackoff theorem ([BS23], Section 4.5, Theorem 4.9; [LR88]): a
3-round Feistel cipher built from three independently keyed instances of a round function F has
distinguishing advantage against a uniform random function on G × G at most
ε₁ + ε₂ + ε₃ + 2 * Q.choose 2 / |G|.
The Luby–Rackoff PRP theorem ([BS23], Section 4.5, Theorem 4.9;
[LR88]): a 3-round
Feistel cipher built from three independently keyed instances of a round function F has
distinguishing advantage against a uniform random permutation on G × G (idealPermGame) at most
ε₁ + ε₂ + ε₃ + 2 * Q.choose 2 / |G| + Q.choose 2 / |G| ^ 2.
Concrete instantiation of the 3-round Luby–Rackoff theorem on BitString n (block size 2n):
the information-theoretic collision error is at most 2 * Q.choose 2 / 2 ^ n.
Chosen-ciphertext separation for 3 rounds and 4-round bidirectional hybrid security #
Ideal bidirectional random-permutation game on G × G: sample a uniform permutation
π ← PMF.uniformOfFintype (Equiv.Perm (G × G)) and answer forward and inverse queries via
feistelStrongOracle π.
Instances For
Bidirectional independent-table game on Bool × (G × G) → G × G, where forward and inverse
queries are answered by two independent uniform random functions.
Instances For
The 3-query chosen-ciphertext distinguisher against 3-round Feistel ([BS23], Exercise 4.15(b)):
- Query encryption at
(l₀, r₀)to obtain(v₀, w₀). - Query encryption at
(l₁, r₀)to obtain(v₁, w₁). - Query decryption at
(v₀, (l₁ - l₀) + w₀)to obtain(l₂, r₂). - Accept iff
-v₀ + r₂ = -v₁ + r₀.
Instances For
feistel3CCAAttack makes at most 3 oracle queries.
Every 3-round Feistel network feistel3 f₁ f₂ f₃ is accepted with probability 1 by
feistel3CCAAttack ([BS23], Exercise 4.15(b)), for any round functions f₁, f₂, f₃
and any l₀, l₁, r₀ : G.
When l₀ = l₁, the third query of feistel3CCAAttack l₀ l₀ r₀ asks to invert the first
ciphertext, so every bidirectional permutation π : G × G ≃ G × G is accepted with probability
1.
At l₀ = l₁, the permutation-ideal game idealStrongGame accepts feistel3CCAAttack l₀ l₀ r₀
with probability 1.
At l₀ = l₁, feistel3CCAAttack l₀ l₀ r₀ has zero advantage between any 3-round Feistel
network and the true bidirectional random-permutation game idealStrongGame.
When l₀, l₁, l₂ : G are pairwise distinct (|G| ≥ 3), the transposition
Equiv.swap (l₀, (l₁ - l₀) + r₀) (l₂, r₀) fixes (l₀, r₀) and (l₁, r₀) while mapping
(l₀, (l₁ - l₀) + r₀) to (l₂, r₀), so feistel3CCAAttack l₀ l₁ r₀ rejects it with probability
1.
When l₀, l₁, l₂ : G are pairwise distinct, idealStrongGame (feistel3CCAAttack l₀ l₁ r₀)
rejects (false) with probability at least |Equiv.Perm (G × G)|⁻¹.
When l₀, l₁, l₂ : G are pairwise distinct (|G| ≥ 3), feistel3CCAAttack l₀ l₁ r₀
distinguishes any 3-round Feistel network from the true bidirectional random-permutation game
idealStrongGame with advantage at least |Equiv.Perm (G × G)|⁻¹.
When l₀, l₁, l₂ : G are pairwise distinct (|G| ≥ 3), feistel3CCAAttack l₀ l₁ r₀ has
strictly positive distinguishing advantage against the true bidirectional random-permutation game
idealStrongGame.
Against the independent-table game independentTableStrongGame, feistel3CCAAttack l₀ l₁ r₀
accepts with probability |G|⁻¹.
The 3-query CCA attack feistel3CCAAttack distinguishes any 3-round Feistel network from
the independent-table game independentTableStrongGame with exact advantage 1 - |G|⁻¹.
When l₀ ≠ l₁, the true bidirectional random-permutation game idealStrongGame accepts
feistel3CCAAttack l₀ l₁ r₀ with probability at most |G|⁻¹ + 4 * |G × G|⁻¹.
Quantitative nonnegligible CCA advantage lower bound against idealStrongGame
([BS23], Section 4.1.3 and Exercise 4.15(b)): whenever l₀ ≠ l₁, the 3-query
chosen-ciphertext distinguisher feistel3CCAAttack l₀ l₁ r₀ distinguishes any 3-round Feistel
network feistel3 f₁ f₂ f₃ from a uniform random permutation on G × G (idealStrongGame) with
advantage at least 1 - |G|⁻¹ - 4 * |G|⁻¹ ^ 2.
4-round Feistel strong (bidirectional) game with four independent keyed round functions
F k₁, F k₂, F k₃, F k₄.
Instances For
4-round Feistel strong (bidirectional) game with four independent uniform random round
functions f₁, f₂, f₃, f₄ : G → G.
Instances For
Round-1 bidirectional PRF reduction distinguisher for 4-round Feistel.
Instances For
Round-2 bidirectional PRF reduction distinguisher for 4-round Feistel.
Instances For
Round-3 bidirectional PRF reduction distinguisher for 4-round Feistel.
Instances For
Round-4 bidirectional PRF reduction distinguisher for 4-round Feistel.
Instances For
4-round bidirectional PRF-to-Feistel hybrid theorem: because Feistel inversion only
evaluates the round functions in the forward direction, replacing four keyed round functions
F k₁, F k₂, F k₃, F k₄ with independent uniform random round functions against any bidirectional
(chosen-ciphertext) adversary adds at most ε₁ + ε₂ + ε₃ + ε₄.
4-round bidirectional random-round collision analysis and strong PRP Luby–Rackoff theorem #
4-round strong Luby–Rackoff theorem in ℝ≥0∞ (one-sided): for any adaptive
bidirectional program making at most Q forward or inverse queries,
feistel4StrongRandomRoundsGame accepts with probability at most idealStrongGame plus
2 * Q.choose 2 * |G|⁻¹ + 2 * Q.choose 2 * |G × G|⁻¹.
Reverse 4-round strong Luby–Rackoff inequality in ℝ≥0∞: for any adaptive bidirectional
program making at most Q forward or inverse queries, idealStrongGame accepts with probability
at most feistel4StrongRandomRoundsGame plus
2 * Q.choose 2 * |G|⁻¹ + 2 * Q.choose 2 * |G × G|⁻¹.
4-round strong Luby–Rackoff theorem with random round functions ([LR88]; see
[BS23], Section 4.1.3 for strongly secure block ciphers; the concrete constant comes
from this proof): when all four round functions f₁, f₂, f₃, f₄ : G → G are
independent uniform random functions, any Q-query adaptive chosen-ciphertext distinguisher has
distinguishing advantage against a uniform random permutation on G × G (idealStrongGame) at
most 2 * Q.choose 2 * |G|⁻¹ + 2 * Q.choose 2 * (|G|⁻¹) ^ 2.
Full 4-round strong PRP Luby–Rackoff theorem ([LR88]; see [BS23],
Section 4.1.3 for strongly secure block ciphers; the concrete constant comes from this proof):
combining the 4-round bidirectional PRF hybrid reduction with the
random-round collision bound shows that a 4-round Feistel network instantiated with four
independent keys from a PRF F : K → G → G is a strong (chosen-ciphertext secure)
pseudorandom permutation on G × G, with distinguishing advantage at most
ε₁ + ε₂ + ε₃ + ε₄ + 2 * Q.choose 2 * |G|⁻¹ + 2 * Q.choose 2 * (|G|⁻¹) ^ 2.
Concrete instantiation of the 4-round strong Luby–Rackoff theorem on BitString n
(block size 2n): the information-theoretic chosen-ciphertext collision error is at most
2 * Q.choose 2 / 2 ^ n + 2 * Q.choose 2 / (2 ^ n) ^ 2.