Exact k-wise independent hashing over explicit trinomial binary fields #
By evaluating degree-< k polynomials over the explicit binary field
Cslib.TrinomialField t = AdjoinRoot (X ^ (2 * 3 ^ t) + X ^ (3 ^ t) + 1) and projecting the result
to its low M ≤ 2 * 3 ^ t coordinates in the power basis, we obtain an explicit, zero-bias
k-wise independent hash family (Cslib.Probability.trinomialPolyHash) from Fin U onto
Fin (2 ^ M) whenever U ≤ 2 ^ (2 * 3 ^ t) and M ≤ 2 * 3 ^ t
(Cslib.Probability.isKWiseIndependentHash_trinomialPolyHash)
Vadhan, Section 3.5.5; Wegman and Carter.
Because the coordinate map
Cslib.TrinomialField.equivBits t : TrinomialField t ≃+ BitString (2 * 3 ^ t)
and the bit-prefix projection BitString (2 * 3 ^ t) →+ BitString M are surjective additive group
homomorphisms over 𝔽₂, every output bucket in Fin (2 ^ M) has the exact same preimage size in
TrinomialField t. Consequently, projecting to the low M bits preserves exact k-wise
independence without modulo bias.
We also provide Cslib.Probability.trinomialStep U M, which selects a trinomial parameter t
satisfying U ≤ 2 ^ (2 * 3 ^ t), M ≤ 2 * 3 ^ t, and
2 * 3 ^ t ≤ 3 * max (Nat.clog 2 (max U 2)) (max M 1).
Main definitions #
Cslib.Probability.trinomialStep: selectst : ℕso that2 * 3 ^ tcovers bothlog₂ UandMwithin a factor of3.Cslib.Probability.trinomialDeg: the field degree2 * 3 ^ trinomialStep U M.Cslib.Probability.trinomialPolyEval: degree-< kpolynomial evaluation overCslib.TrinomialField ton natural-number word coordinates.Cslib.Probability.trinomialPolyHash: thek-wise independent trinomial polynomial hash family fromFin UtoFin (2 ^ M).
Main results #
Cslib.Probability.isKWiseIndependentHash_trinomialPolyHash:trinomialPolyHash t k U Misk-wise independent wheneverU ≤ 2 ^ (2 * 3 ^ t)andM ≤ 2 * 3 ^ t.Cslib.Probability.le_two_pow_trinomialDeg,Cslib.Probability.le_trinomialDeg,Cslib.Probability.trinomialDeg_le_three_mul: degree bounds fortrinomialStep U M.
References #
Trinomial degree selection #
Smallest exponent t : ℕ such that B ≤ 2 * 3 ^ t.
Instances For
2 * 3 ^ trinomialStepAux B is at least B.
2 * 3 ^ trinomialStepAux B is at most 3 * max B 1.
Target bit-width needed to embed Fin U and project to M bits.
Instances For
Selected trinomial parameter t for universe size U and output bit-length M.
Instances For
Selected trinomial field degree 2 * 3 ^ trinomialStep U M.
Instances For
The selected trinomial degree is at least trinomialTargetBits U M.
The universe size U fits inside 2 ^ trinomialDeg U M.
The output bit-length M is at most trinomialDeg U M.
The selected trinomial degree is within a factor of 3 of trinomialTargetBits U M.
Trinomial polynomial hashing #
Evaluate the degree-< k polynomial with seed coefficients c : Fin k → Fin (2 ^ (2 * 3 ^ t))
over TrinomialField t at the key u : Fin U, returning the 2 * 3 ^ t-bit result as an element
of Fin (2 ^ (2 * 3 ^ t)).
Instances For
The k-wise independent trinomial polynomial hash family from Fin U to Fin (2 ^ M):
evaluates a degree-< k polynomial over TrinomialField t and projects to the low M bits.
Instances For
The numeric output of trinomialPolyHash is the bitwise mask &&& (2 ^ M - 1) of
trinomialPolyEval.
When M ≤ 2 * 3 ^ t, trinomialPolyHash agrees with projecting the power-basis bits of the
field polynomial evaluation to the first M bits.
trinomialPolyHash t k U M is an exact k-wise independent hash family onto Fin (2 ^ M)
whenever U ≤ 2 ^ (2 * 3 ^ t) and M ≤ 2 * 3 ^ t.