Uniform random-function evaluations and shifted collisions on bit strings #
Two elementary sampling facts about BitString n with its coordinatewise XOR group structure.
Evaluating a uniform random function BitString n → BitString n at a fixed injective family of
points gives independent uniform values, also after XOR with any fixed vector. A uniform block
shifted by a fixed offset lands in a fixed finite set S with probability exactly
S.card / 2 ^ n, and in a fixed list ks with probability at most ks.length / 2 ^ n.
These are the per-step ingredients of lazy-sampling arguments for block-cipher modes and message authentication codes.
Main results #
Cslib.BitString.map_evalPoints_uniformOfFintype,Cslib.BitString.map_xorEvalPoints_uniformOfFintype: a uniform random function evaluated at an injective point family, optionally masked by a fixed vector, is uniform.Cslib.BitString.toOuterMeasure_addRight_mem_finset_eq,Cslib.BitString.toOuterMeasure_addRight_mem_list_le: exact finite-set and list-cache collision probabilities for a shifted uniform block.
Fixed-schedule distinct-point evaluation uniformity: for any fixed (non-adaptive) injective
point family pts : ι → BitString n, evaluating a uniform random function
g ← PMF.uniformOfFintype (BitString n → BitString n) at pts produces a uniform random vector
in ι → BitString n.
Distinct-point masked uniformity: when the evaluation points pts : ι → BitString n are
pairwise distinct, XORing g (pts i) with any fixed vector m : ι → BitString n under a uniform
random function g produces the uniform distribution on ι → BitString n, independent of m.
Single-step shifted-block collision probability: for any finite set
S : Finset (BitString n) and offset b : BitString n, a uniform block
u ← PMF.uniformOfFintype (BitString n) satisfies u + b ∈ S with exact outer measure
S.card * (2 ^ n : ℝ≥0∞)⁻¹.
List-cache version of toOuterMeasure_addRight_mem_finset_eq: for any list
ks : List (BitString n) and offset b : BitString n, a uniform block u satisfies
u + b ∈ ks with outer measure at most ks.length * (2 ^ n : ℝ≥0∞)⁻¹.