Documentation

CslibFrontier.Crypto.Primitives.PRF.Finite

Finite pseudorandom functions #

A keyed function F : Key → D → R on finite types is compared with a uniformly random function D → R by an adaptive oracle adversary with private coins ([BS23], Section 4.4, Attack Game 4.2). The real experiment samples one uniform key and answers every query x with F key x; the ideal experiment samples one whole random function f and answers every query with f x. The adversary's private samples are independent of the key or table. The advantage is the distinguishing advantage of the two experiments.

This is the concrete, single-key form of PRF security for arbitrary finite domains and ranges. It complements the word-level asymptotic games Cslib.Crypto.prfRealGame and Cslib.Crypto.prfIdealGame. Several independent keys reduce to this game through the hybrid reductions of Cslib.Crypto.PRF.multiKeyReduction, which the finite Luby–Rackoff theorems use.

Main definitions #

Main results #

References #

@[reducible, inline]

An adaptive test with private coins and oracle access to a function D → R.

noncomputable def Cslib.Crypto.PRF.realExperiment {Key D R : Type} [Fintype Key] [Nonempty Key] (F : Key → D → R) (A : Adversary D R) :

The real experiment: sample one uniform key and answer every query x with F key x.

noncomputable def Cslib.Crypto.PRF.idealExperiment {D R : Type} [Fintype D] [DecidableEq D] [Fintype R] [Nonempty R] (A : Adversary D R) :

The ideal experiment: sample one uniform function f : D → R and answer every query x with f x.

@[reducible, inline]
noncomputable abbrev Cslib.Crypto.PRF.advantage {Key D R : Type} [Fintype Key] [Nonempty Key] [Fintype D] [DecidableEq D] [Fintype R] [Nonempty R] (F : Key → D → R) (A : Adversary D R) :

The PRF distinguishing advantage of A against F.

theorem Cslib.Crypto.PRF.eval_realExperiment {Key D R : Type} [Fintype Key] [Nonempty Key] (F : Key → D → R) (A : Adversary D R) :

The law of realExperiment: a uniform key, then the adversary interpreted at the PMF level against F key.

The law of idealExperiment: a uniform function f, then the adversary interpreted at the PMF level against f.

The law of idealExperiment with the random function sampled lazily: a memoize list cache draws one uniform value for each new query and replays it for repeated queries.