Compression functions from block ciphers #
[KL20], Section 7.3.1, builds a compression function from a block cipher
F : K × B → B, where each F k is a permutation of the block space B whose inverse is also
efficiently computable. The Davies–Meyer construction (Figure 7.11) is
h(k, x) = F_k(x) ⊕ x; Theorem 7.5 shows it is collision resistant when F is an ideal cipher.
Here we record the explicit attacks that rule out other natural choices, using only that each
F k is a permutation with an inverse:
h(k, x) = F_k(x)([KL20], Exercise 7.23(a)),h(k, x) = F_k(x) ⊕ k([KL20], Exercise 7.23(c); equivalentlyh₄of [BS23], Section 8.5.2, p. 301, with its two arguments swapped), andh₅(k, x) = F_k(k ⊕ x) ⊕ k([BS23], Section 8.5.2, p. 301) have preimages computable with one inverse query, so any two distinct keys give a collision (forh₄andh₅, [BS23], Exercise 8.11, p. 349);- Davies–Meyer sends every fixed point
F_k(x) = xto0, so two distinct fixed points collide ([KL20], Exercise 7.24).
The block space is any additive group (for bits, BitString n, where + is exclusive or); the
attacks of Exercise 7.23 and Exercise 8.11 hold over every additive group, while the fixed-point
attack uses x + x = 0 on bit strings. The ideal-cipher bound of Theorem 7.5 and Exercise 7.23(b),
h(k, x) = F_k(x) ⊕ k ⊕ x, are not formalized here; for the 2-query ideal-cipher collision
finders on keyMasked and keyMaskedInput, see
CslibFrontier.Crypto.Primitives.IdealCipher.CompressionVariants.
Main definitions #
Cslib.Crypto.BlockCipherCompression.daviesMeyer: the Davies–Meyer compression function.Cslib.Crypto.BlockCipherCompression.cipherOutput,Cslib.Crypto.BlockCipherCompression.keyMasked,Cslib.Crypto.BlockCipherCompression.keyMaskedInput: the compression functions of [KL20], Exercise 7.23(a), (c) and [BS23], Section 8.5.2 (h₄,h₅).
Main results #
Cslib.Crypto.BlockCipherCompression.cipherOutput_collision,Cslib.Crypto.BlockCipherCompression.keyMasked_collision,Cslib.Crypto.BlockCipherCompression.keyMaskedInput_collision: explicit collisions from two distinct keys and inverse queries.Cslib.Crypto.BlockCipherCompression.daviesMeyer_collision_of_fixedPoints: two distinct fixed points give a Davies–Meyer collision.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Section 8.5.2, p. 301, and Exercise 8.11, p. 349.
- J. Katz, Y. Lindell, Introduction to Modern Cryptography, Section 7.3.1, Figure 7.11, Theorem 7.5, Exercises 7.23 and 7.24.
The compression functions #
The Davies–Meyer compression function h(k, x) = F_k(x) + x ([KL20],
Section 7.3.1, Figure 7.11).
The compression function h(k, x) = F_k(x) of [KL20], Exercise 7.23(a).
The compression function h(k, x) = F_k(x) + k of [KL20], Exercise 7.23(c); keys
and blocks have the same type. Up to swapping its two arguments, this is h₄ of
[BS23], Section 8.5.2, p. 301.
The compression function h₅(k, x) = F_k(k + x) + k ([BS23], Section 8.5.2,
p. 301); keys and blocks have the same type. Over bit strings (BitString n), + is exclusive
or, so this matches h₅(x, y) := E(x, x ⊕ y) ⊕ x.
Inverse-query attacks on Exercise 7.23(a), (c) and Exercise 8.11 #
One inverse query finds a preimage of y under h(k, x) = F_k(x), for any key k.
Exercise 7.23(a) ([KL20], Section 7.3.1): for distinct keys k ≠ k' and any
target y, the inputs (k, F_k⁻¹(y)) and (k', F_{k'}⁻¹(y)) are distinct and collide under
h(k, x) = F_k(x).
One inverse query finds a preimage of y under h(k, x) = F_k(x) + k: take
x = F_k⁻¹(y - k).
Exercise 7.23(c) ([KL20], Section 7.3.1; also the h₄ part of
[BS23], Exercise 8.11, p. 349): for distinct keys k ≠ k' and any target y, the
inputs (k, F_k⁻¹(y - k)) and (k', F_{k'}⁻¹(y - k')) are distinct and collide under
h(k, x) = F_k(x) + k.
keyMaskedInput is keyMasked composed with the map (k, x) ↦ (k, k + x).
One inverse query finds a preimage of y under h₅(k, x) = F_k(k + x) + k: take
x = -k + F_k⁻¹(y - k).
Exercise 8.11 ([BS23], Exercise 8.11, p. 349; h₅ is defined in
Section 8.5.2, p. 301): for distinct keys k ≠ k' and any target y, the inputs
(k, -k + F_k⁻¹(y - k)) and (k', -k' + F_{k'}⁻¹(y - k')) are distinct and collide under
keyMaskedInput (h₅).
Fixed points and Davies–Meyer (Exercise 7.24) #
Over any additive group, Davies–Meyer outputs 0 exactly on the inputs with
F_k(x) = -x.
On bit strings, Davies–Meyer outputs 0 exactly on the fixed points F_k(x) = x.
Exercise 7.24 ([KL20], Section 7.3.1): two distinct fixed points
F_k(x) = x and F_{k'}(x') = x' (possibly for the same key) collide under Davies–Meyer, both
hashing to 0.