Documentation

CslibFrontier.Probability.HashFamily.UniformOffset

Prediction after a uniform additive offset #

Changing variables from the offset to the first masked digest gives a uniform digest independent of the key. A correct masked prediction for a distinct message then gives a correct prediction of the difference between the original digests. These identities are shared by the one-time Carter–Wegman experiment and pairwise unpredictability.

theorem Cslib.Probability.add_recovered_offset_eq_iff {Y : Type u_1} [AddGroup Y] (first second t t' : Y) :
second + (-first + t) = t' ↔ second - first = t' - t

With the offset recovered from the first shifted digest, a second shifted digest equals the prediction exactly when the original digests have the predicted difference.

theorem Cslib.Probability.IsDeltaUniversalHash.bind_recovered_offset_le {K : Type u_1} {M : Type u_2} {Y : Type u_3} [AddGroup Y] [DecidableEq M] [DecidableEq Y] {seed : PMF K} {hash : K → M → Y} {ε : ENNReal} (h : IsDeltaUniversalHash seed hash ε) (m m' : M) (t t' : Y) :
(seed.bind fun (k : K) => PMF.pure (decide (m' ≠ m) && decide (hash k m' + (-hash k m + t) = t'))) true ≤ ε

A fixed prediction after seeing a masked digest succeeds for a distinct message only when the original digests have the predicted difference. The key may have any distribution.

theorem Cslib.Probability.IsDeltaUniversalHash.bind_uniform_offset_le {K : Type u_1} {M : Type u_2} {Y : Type u_3} [AddGroup Y] [DecidableEq M] [DecidableEq Y] {seed : PMF K} {hash : K → M → Y} {ε : ENNReal} {A : Type u_4} [Fintype Y] (h : IsDeltaUniversalHash seed hash ε) (m : M) (respond : Y → PMF A) (message : A → M) (digest : A → Y) :
(seed.bind fun (k : K) => (PMF.uniformOfFintype Y).bind fun (offset : Y) => (respond (hash k m + offset)).bind fun (guess : A) => PMF.pure (decide (message guess ≠ m) && decide (hash k (message guess) + offset = digest guess))) true ≤ ε

After seeing the first digest masked by a private uniform offset, an adaptive prediction for a distinct message succeeds with probability at most the original difference-universality bound. The response may retain arbitrary data in its outcome.