Documentation

CslibFrontier.Crypto.Primitives.PRG.ModReduction

Modular reduction of finite pseudorandom generators #

Reduction of a finite-type PRG.Generator Seed (Fin N) modulo m, giving Generator.modNat, and the concrete advantage inequality of Boneh–Shoup Example 3.3 (Generator.advantage_modNat_le) for every adversary. Example 3.3 itself, that the residues are computationally indistinguishable from uniform when the generator is secure and m / N is negligible, is Cslib.Crypto.ComputationallyIndistinguishable.map_modWord and Cslib.Crypto.PseudorandomGenerator.indistinguishable_map_modWord, whose reduction is certified PPT (Cslib.Crypto.isPPT_modDistinguisher).

Main definitions #

Main results #

References #

def Cslib.Crypto.PRG.Generator.modNat {Seed : Type u_1} {N : ℕ} (G : Generator Seed (Fin N)) (m : ℕ) :
Generator Seed (ZMod m)

The generator G, whose outputs are numbers below N, followed by reduction modulo m ([BS23], Example 3.3, p. 86).

@[simp]
theorem Cslib.Crypto.PRG.Generator.modNat_apply {Seed : Type u_1} {N : ℕ} (G : Generator Seed (Fin N)) (m : ℕ) (seed : Seed) :
(G.modNat m) seed = ↑↑(G seed)
theorem Cslib.Crypto.PRG.Generator.advantage_modNat_le {Seed : Type u_1} [Fintype Seed] [Nonempty Seed] {N : ℕ} [NeZero N] (G : Generator Seed (Fin N)) (m : ℕ) [NeZero m] (adversary : Adversary (ZMod m)) :
(G.modNat m).advantage adversary ≤ (G.advantage fun (y : Fin N) => adversary ↑↑y) + ↑m / ↑N

Example 3.3 for a generator on finite types ([BS23], p. 87): Distadv[A, P₀, P₁] ≤ PRGadv[B, G] + m / N, where P₀ is the output of G reduced modulo m, P₁ is uniform on ZMod m, and B reduces its challenge modulo m and runs A. Nothing is assumed about G or A, and N need not be a power of two.