Pseudorandom generator from a pseudorandom function #
Evaluating a keyed function F : Key → D → R at ℓ distinct domain points x : Fin ℓ ↪ D
yields a deterministic generator PRF.toPRG F x : PRG.Generator Key (Fin ℓ → R) sending a key k
to fun i => F k (x i) ([BS23], §4.4.4, Theorem 4.8, p. 138).
Given a randomized PRG distinguisher A : (Fin ℓ → R) → ProbComp Bool, PRF.prgReduction x A
queries x 0, ..., x (ℓ - 1) through the PRF oracle (PRF.queryPoints x), passes the collected
tuple to A, and outputs whatever A outputs. It makes ℓ external queries
(PRF.isQueryBounded_prgReduction) and achieves the exact same advantage
(PRF.advantage_toPRG_eq):
(toPRG F x).advantage (fun y => ProbComp.eval (A y)) = (PRF.advantage F (prgReduction x A) : ℝ).
Here A ranges over ProbComp-valued tests rather than arbitrary Cslib.Crypto.PRG.Adversary
((Fin ℓ → R) → PMF Bool) because general PMF values with arbitrary real weights cannot be
simulated inside a finitely-branching ProbComp adversary.
This finite-type identity is a step toward Theorem 4.8, not the cited result: in the theorem the
reduction is an elementary wrapper around A and the conclusion is that the generator is a secure
PRG, while nothing here certifies prgReduction as efficient. In
CslibFrontier.Crypto.Computational.PseudorandomFunction.ToPRG, the theorem's security conclusion
is Cslib.Crypto.indistinguishable_prgFromPRF. The exact identity
Cslib.Crypto.advantage_prgFromPRF_eq explains the reduction: it equates the two advantages for
the oracle-PPT word reduction Cslib.Crypto.prgFromPRFReduction, which runs prgReduction.
Cslib.Crypto.PseudorandomFunctionOver.toPRG concludes PseudorandomGenerator and so also needs
strict stretch, n < ℓ n * outLen n. For example, one output block as wide as the seed gives
indistinguishable outputs but no stretch.
Main definitions #
Cslib.Crypto.PRF.toPRG: generator obtained by evaluatingFatx : Fin ℓ ↪ D.Cslib.Crypto.PRF.queryPoints: adaptive oracle program collecting replies atx 0, ..., x (ℓ - 1).Cslib.Crypto.PRF.prgReduction: PRF adversary running aProbCompdistinguisher on those replies.
Main results #
Cslib.Crypto.PRF.isQueryBounded_prgReduction: the reduction makes at mostℓoracle queries.Cslib.Crypto.PRF.eval_realExperiment_prgReduction: real PRF experiment agrees with the PRG real experiment.Cslib.Crypto.PRF.eval_idealExperiment_prgReduction: ideal PRF experiment agrees with the PRG ideal experiment.Cslib.Crypto.PRF.isExpanding_toPRG:PRF.toPRG F xis expanding when|Key| < |R| ^ ℓ.
Step toward Theorem 4.8 #
Cslib.Crypto.PRF.advantage_toPRG_eq: exact PRG-to-PRF advantage identity on finite types.
References #
- D. Boneh, V. Shoup, A Graduate Course in Applied Cryptography, Version 0.6, §4.4.4 (Theorem 4.8, p. 138).
Pseudorandom generator constructed from a keyed function F : Key → D → R by evaluating at
ℓ distinct domain elements x 0, ..., x (ℓ - 1) ([BS23], §4.4.4, p. 138).
Query the PRF oracle at x 0, ..., x (ℓ - 1) in order and return the reply tuple.
Evaluating queryPoints x against a deterministic function f : D → R returns f ∘ x.
queryPoints x makes at most ℓ queries on every execution path.
The PRF reduction prgReduction x A makes at most ℓ oracle queries regardless of private
coins and oracle replies.
Against F, the PRF real experiment of prgReduction x A has the same distribution as the PRG
real experiment of toPRG F x on A.
In the ideal PRF experiment, querying x : Fin ℓ ↪ D yields a uniformly random Fin ℓ → R
tuple, matching the PRG ideal experiment on A.
Finite-type advantage identity, a step toward [BS23], Theorem 4.8 (p. 138), not the
cited result: for any ProbComp-valued distinguisher A on Fin ℓ → R, its PRG distinguishing
advantage against toPRG F x equals the PRF distinguishing advantage of the ℓ-query reduction
prgReduction x A against F. Nothing here certifies prgReduction as efficient. The theorem's
security conclusion, with an oracle-PPT reduction, is Cslib.Crypto.indistinguishable_prgFromPRF;
its exact identity is Cslib.Crypto.advantage_prgFromPRF_eq.
toPRG F x is length-expanding (|Key| < |Fin ℓ → R|) whenever |Key| < |R| ^ ℓ.