Documentation

CslibFrontier.Crypto.Computational.CollisionResistantToOneWay

One-way functions from collision-resistant hash families #

A collision-resistant hash family yields a one-way function ([KL20], Exercise 8.4). The function CollisionResistantToOneWay.keyDigest H reads its input as a key k (the first third) followed by a message x (the rest), and outputs k ++ H k x. Publishing the key turns the keyed family into the single function on bit strings that OneWay asks for.

On inputs of length 3 n + r with r < 3, the key has n bits and the message 2 n + r bits. An inverter that finds a preimage of k ++ H k x returns a message x' with H k x' = H k x. Either x' ≠ x, which is a collision under the uniform key k, or x' = x. The inverter sees x only through its n-bit digest, so it returns x itself with probability at most 2 ^ n / 2 ^ (2 n + r) ≤ (1 / 2) ^ n. The bound is CollisionResistantToOneWay.succProbability_inversionGame_le; one collision finder for each residue r covers every input length.

With Rompel's theorem (OneWay.exists_wordEUFCMA), collision-resistant hashing therefore gives stateless signatures that are existentially unforgeable under adaptive chosen-message attacks ([KL20], Theorem 14.16; this also covers the one-time schemes of Lemma 14.13). Merkle–Damgård domain extension gives the same conclusions for 2 n → n compression families, the setting of Exercise 8.4. No converse is claimed: one-way functions are not known to give collision-resistant hash families.

Main definitions #

Main results #

References #

Read a word as a key (its first third) followed by a message, and output the key followed by the message's digest under that key.

The collision finder built from an inverter. On key k at parameter n, it samples a message x of length 2 n + r, asks the inverter for a preimage of k ++ H k x at parameter 3 n + r, and pairs x with the message part of the answer.

theorem Cslib.Crypto.CollisionResistantToOneWay.keyDigest_append (H : List Bool → List Bool → List Bool) {key message : List Bool} {r : ℕ} (hmessage : message.length = 2 * key.length + r) (hr : r < 3) :
keyDigest H (key ++ message) = key ++ H key message

On a key followed by a message of length 2 |k| + r with r < 3, the construction outputs the key followed by the message's digest.

theorem Cslib.Crypto.CollisionResistantToOneWay.isCollision_or_eq_of_keyDigest_eq {H : List Bool → List Bool → List Bool} (hlen : ∀ (key message : List Bool), (H key message).length = key.length) (n : ℕ) {candidate key message : List Bool} (h : keyDigest H candidate = key ++ H key message) :
isCollision H (fun (x : ℕ) (x_1 : List Bool) => true) n key message (List.drop (candidate.length / 3) candidate) = true ∨ List.drop (candidate.length / 3) candidate = message

If a candidate's image is k ++ H k x for a length-preserving family, its message part either collides with x under k or is x itself.

theorem Cslib.Crypto.CollisionResistantToOneWay.succProbability_inversionGame_le {H : List Bool → List Bool → List Bool} (hlen : ∀ (key message : List Bool), (H key message).length = key.length) (adversary : Inverter) (n r : ℕ) (hr : r < 3) :
Game.succProbability (inversionGame (keyDigest H) adversary (3 * n + r)).eval ≤ Game.succProbability (collisionGame H (fun (x : ℕ) (x_1 : List Bool) => true) (finder H adversary r) n).eval + (1 / 2) ^ n

The reduction. Inverting the construction at length 3 n + r with r < 3 succeeds at most as often as the collision finder built from the inverter succeeds at parameter n, plus (1 / 2) ^ n: a successful inverter either finds a collision under the uniform key or recovers the (2 n + r)-bit message, of which it sees only an n-bit digest.

Collision-resistant hashing gives a one-way function ([KL20], Exercise 8.4). For a collision-resistant hash family H, the map k ++ x ↦ k ++ H k x, whose key k is the first third of the input, is one-way. At input length 3 n + r, succProbability_inversionGame_le reduces inversion to the collision finder for the residue r; the three finders cover every length.

Collision-resistant hash families yield one-way functions ([KL20], Exercise 8.4).

A collision-resistant hash family yields a stateless EUF-CMA secure SignatureScheme on n-bit messages, through HashFamily.oneWay_keyDigest and Rompel's theorem.

Signatures from collision-resistant hashing ([KL20], Theorem 14.16): a collision-resistant hash family yields a stateless EUF-CMA secure WordSignatureScheme on messages of arbitrary length. Many-time security includes the one-time security of Lemma 14.13.

A collision-resistant 2 n → n compression family yields a one-way function, the setting of [KL20], Exercise 8.4: Merkle–Damgård extends it to a hash family on all bit strings.

A collision-resistant 2 n → n compression family yields a stateless EUF-CMA secure WordSignatureScheme on messages of arbitrary length ([KL20], Theorem 14.16).