Binary linear hashing #
A uniformly random Boolean matrix is a two-universal family: hashing a nonzero input gives a
uniform output. Prefixes of one public matrix supply every shorter hash length, including zero.
The list implementation reads fixed-width rows, pads missing seed bits with false, and takes
an AND/XOR fold. It reuses the existing block representation and ordinary list operations.
Main definitions #
Cslib.BitString.LinearHash.hash: matrix hashing on finite bit strings.Cslib.BitString.LinearHash.wordHash: its total list implementation.
Main results #
Cslib.BitString.LinearHash.isDeltaUniversalHash,Cslib.BitString.LinearHash.isTwoUniversal: the uniform matrix family is2⁻ᵐ-XOR-universal, hence universal.Cslib.BitString.LinearHash.isTwoUniversal_prefix: universality with unused public rows.Cslib.BitString.LinearHash.wordHash_eq_ofFn: exact agreement of the two representations.
References #
- I. Haitner, S. Vadhan, The Many Entropies in One-Way Functions, Section 2.4.1, the Boolean-matrix example following Definition 4.
- T. Holenstein, Pseudorandom Generators from One-Way Functions: A Simple Construction for Any Hardness, Section 3.3, Lemma 1. Matrix hashing uses more seed bits than the cited field-multiplication family, while retaining polynomial seed length.
Adapted from Probability/LinearHash.lean on the cslib crypto branch at
5ff69ca93402e7c947208dc56396d6d86203ccd8, in the shared bit-string namespace.
Hashing any nonzero input by a uniform matrix gives a uniform output.
The difference of the hashes of distinct inputs is uniform.
Uniform Boolean matrices are a 2⁻ᵐ-Δ-universal hash family: the bitwise XOR of two hashes
of distinct inputs is uniform.
Uniform Boolean matrices are a universal hash family, including zero-width outputs.
Prefixes of one public matrix give universal hashes at every shorter output length.
A uniformly sampled flat matrix gives the usual two-universal family.