Documentation

VCVio.CryptoFoundations.HardnessAssumptions.CollisionResistance

Collision-Resistant Hash Functions #

This file defines collision resistance for unkeyed hash functions and for keyed hash function families, together with their security experiments.

Collision Resistance #

A function f : X → Y is collision-resistant if no efficient adversary can find two distinct inputs x ≠ x' with f x = f x'.

Keyed Hash Function Families #

A keyed hash family samples a public key k : K and the adversary must find a collision under f k. This is the form used in practical constructions and in the Merkle-tree / FRI commitment-scheme setting where the hash key is a protocol parameter.

Main Definitions #

See also #

Unkeyed Collision Resistance #

A collision-resistance adversary outputs a candidate pair of inputs that it hopes form a collision under the target hash function.

Instances For
    def CollisionResistance.crExp {X Y : Type} [DecidableEq X] [DecidableEq Y] (f : XY) (adversary : CRAdversary X) :

    Collision-resistance experiment: the adversary proposes a pair (x, x'), and the experiment returns true iff the two inputs are distinct and map to the same image under f.

    Instances For
      noncomputable def CollisionResistance.crAdvantage {X Y : Type} [DecidableEq X] [DecidableEq Y] (f : XY) (adversary : CRAdversary X) :

      Collision-resistance advantage: the probability that the adversary produces a valid collision for f.

      Instances For

        Keyed Hash Function Families #

        A keyed hash family with key space K, domain X, and range Y. The key-sampling algorithm is probabilistic; the hash itself is a deterministic function of the key and input.

        Instances For

          A keyed CR adversary receives the public key and outputs a candidate collision pair.

          Instances For

            Keyed collision-resistance experiment: sample a key, run the adversary on the key, and return true iff the adversary's pair is a valid collision under H.hash k.

            Instances For
              noncomputable def CollisionResistance.keyedCRAdvantage {X Y K : Type} [DecidableEq X] [DecidableEq Y] (H : KeyedHashFamily K X Y) (adversary : KeyedCRAdversary K X) :

              Keyed collision-resistance advantage: the probability of producing a valid collision under the sampled key.

              Instances For

                ROM-Level Collision Resistance #

                Companion section modelling collision resistance directly in the random-oracle model. A ROM-CR adversary is an oracle computation outputting a candidate collision pair (x, x'). The experiment runs the adversary inside cachingOracle, then queries the random oracle on both candidates sharing the same cache; it wins iff x ≠ x' and the queried outputs coincide.

                For any t-query ROM-CR adversary the advantage is bounded by the birthday term (t+2) * (t+1) / (2 * |Y|) — a (t+2)-query game once the two verification queries are accounted for.

                Closes one of the layers requested in Verified-zkEVM/VCV-io#284.

                @[reducible, inline]

                The random-oracle spec with domain X and range Y: each input x : X is a distinct oracle index returning a value in Y.

                Instances For

                  A ROM-CR adversary is an oracle computation outputting a candidate collision pair under the random oracle.

                  Instances For

                    A ROM-CR adversary bundled with a total query bound.

                    Instances For

                      ROM collision-resistance experiment: run the adversary inside cachingOracle from the empty cache, then query the random oracle on both candidate inputs (verification queries share the cache). Win iff the inputs are distinct and the queried outputs coincide.

                      Instances For

                        ROM collision-resistance advantage: probability that the adversary produces a valid collision under the random oracle.

                        Instances For
                          theorem CollisionResistance.romCRAdvantage_le_birthday {X Y : Type} [DecidableEq X] [DecidableEq Y] [Fintype Y] [Inhabited X] [Inhabited Y] {t : } (hY : 0 < Fintype.card Y) (A : BoundedROMCRAdversary X Y t) :
                          romCRAdvantage A ↑((t + 2) * (t + 1)) / (2 * (Fintype.card Y))

                          ROM Collision Resistance birthday bound: for any t-query ROM-CR adversary A over a hash range of cardinality |Y| > 0, the advantage is bounded by (t+2) * (t+1) / (2 * |Y|). The two extra queries account for the experiment's verification queries, which share the adversary's cache.