Universal hashing and the leftover hash lemma #
A hash family whose seed is independent of the source and published with the digest turns a
source with small collision probability into almost uniform bits: this is the leftover hash
lemma. It is proved once, for ε-universal families (Cslib.Probability.IsUniversalHash): the
joint law of the seed and the digest is within √(|Output| (CP + ε) - 1) / 2 of the seed with an
independent uniform value, where CP is the collision probability of the source. Universal
families in the sense of Carter and Wegman have ε = 1 / |Output|
(Cslib.Probability.IsTwoUniversal), and then the bound is √(|Output| CP) / 2.
The statements allow any finite seed distribution satisfying the collision bound. They are information-theoretic results; efficient sampling and evaluation require separate certificates.
Main definitions #
Cslib.Probability.IsTwoUniversal:1 / |Output|-universal families.Cslib.Probability.seededHash: reveal the independent hash seed and its digest together.
Main results #
Cslib.Probability.IsDeltaUniversalHash.isTwoUniversal: a1 / |Output|-Δ-universal family is two-universal.Cslib.Probability.IsTwoUniversal.sum_ite_le,Cslib.Probability.isTwoUniversal_iff_sum_ite_le: real-valued pairwise collision bound(|Output| : ℝ)⁻¹.Cslib.Probability.isTwoUniversal_uniformOfFintype_iff,Cslib.Probability.IsTwoUniversal.expect_boole_le: two-universality under a uniform seed as a uniform expectation bound.Cslib.Probability.IsUniversalHash.collision_with_set_le: isolation by a union bound.Cslib.Probability.IsUniversalHash.leftover_hash_sq,Cslib.Probability.IsUniversalHash.leftover_hash: the strong leftover hash lemma forε-universal families.Cslib.Probability.IsTwoUniversal.leftover_hash: its form for universal families.Cslib.Probability.IsTwoUniversal.leftover_hash_conditional: extraction with side information.
References #
- J. L. Carter, M. N. Wegman, Universal Classes of Hash Functions
- T. Holenstein, Pseudorandom Generators from One-Way Functions: A Simple Construction for Any Hardness, Section 3.3, Lemma 1. Its collision argument generalizes from field hashing and uniform seeds to any seed distribution satisfying the collision bound.
- I. Haitner, S. Vadhan, The Many Entropies in One-Way Functions, Section 2.4.1, Definition 4 and Lemma 8.
Adapted from Probability/UniversalHash.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8, using the upstream finite-PMF distance.
A universal hash family in the sense of Carter and Wegman [CW79]: distinct inputs
collide with probability at most 1 / |Output|.
Instances For
A 1 / |Output|-Δ-universal hash family is two-universal.
For a universal hash family, distinct inputs collide with total seed probability at most
(|Output| : ℝ)⁻¹.
Two-universality is equivalent to the real-valued pairwise collision bound (|Output| : ℝ)⁻¹
on every pair of distinct inputs.
Under the uniform seed distribution, two-universality is equivalent to bounding the uniform
expectation of the collision indicator of distinct inputs by 1 / |Output|.
Under the uniform seed distribution, two-universality bounds the uniform expectation of the
collision indicator of distinct inputs by 1 / |Output|.
Applying a shared public hash seed cannot increase distance between source distributions.
An empty digest is already uniform. This exact case avoids charging an extraction error when the source has too little entropy to supply even one prefix bit.
A hash fails to isolate a fixed input from a candidate set only if one of the other candidates collides with it. Universality and the union bound control this probability.
A hash fails to isolate a fixed input from a candidate set only if one of the other
candidates collides with it. For a universal family this has probability at most the number of
other candidates divided by |Output|.
An ε-universal family bounds the average collision probability of the hashed source by
the collision probability of the source plus ε.
A universal family bounds the average collision probability of the hashed source by the
collision probability of the source plus 1 / |Output|.
Leftover hash lemma for ε-universal families, in squared form: the seed stays public,
and independent uniform bits replace the digest, at squared distance at most
(|Output| (CP + ε) - 1) / 4, where CP is the collision probability of the source.
Leftover hash lemma for ε-universal families: the seed stays public, and independent
uniform bits replace the digest, with error at most √(|Output| (CP + ε) - 1) / 2.
The strong leftover hash lemma for universal families, in squared form without logarithms or square roots.
The strong leftover hash lemma: the seed stays public and independent uniform bits replace the hash value, with error at most half the square root of output size times source collision.
A pointwise probability bound is sufficient for the leftover hash lemma. This is the
min-entropy form: use mass = 2⁻ᵏ for a source with at least k bits of min-entropy.
Revealing side information costs the average collision probability of the conditional sources. The hash seed is sampled independently of both the side information and the source.
Conditional leftover hashing in its usual square-root form.