Documentation

CslibFrontier.Crypto.Primitives.UHF.XorHash

Position-tagged XOR hashing with a uniform table #

XOR-hash looks up each block together with its position and adds the results in a commutative group. Addition on bit strings is XOR. The position distinguishes repeated occurrences of a block, and the list may be empty.

The uniform-table analysis is a step in the proof of Theorem 7.6. For two distinct messages, there is a tagged block in exactly one of them. Translating that table entry translates the digest difference by any desired amount. The resulting difference is uniform, giving the optimal difference and collision bounds for the ideal table. The finite PRF reduction is in Crypto.Primitives.UHF.XorHash.PRF.

Main definitions #

Main results #

References #

def Cslib.Crypto.UHF.xorHashQueryAt {X : Type} {ℓ : ℕ} (m : { xs : List X // xs.length ≤ ℓ }) :
Fin (↑m).length ↪ X × Fin ℓ

The query at a position consists of its block and the same position in the full domain.

def Cslib.Crypto.UHF.xorHash {X Y : Type} {ℓ : ℕ} [AddCommMonoid Y] (f : X × Fin ℓ → Y) (m : { xs : List X // xs.length ≤ ℓ }) :
Y

XOR-hash from Figure 7.2 ([BS23], v0.6, §7.2.3), with zero-based position tags. For a fixed table f, the hash sums f (mᵢ, i) over the positions of the message. This uses any additive commutative monoid, with bit-string addition giving the source's XOR.

theorem Cslib.Crypto.UHF.uniform_xorHash_sub {X Y : Type} {ℓ : ℕ} [Fintype X] [DecidableEq X] [Fintype Y] [AddCommGroup Y] {m m' : { xs : List X // xs.length ≤ ℓ }} (hne : m ≠ m') :

A step in the ideal-game analysis of Theorem 7.6 ([BS23], v0.6, pp. 261–262). With an independent uniform value at every tagged position, two distinct messages have a uniform digest difference. This applies to arbitrary finite additive commutative digests.

An ideal uniform table gives XOR-hash difference universality with bound 1 / |Y|.