Documentation

CatCryptCore.Crypto.Assumptions.OWF

One-Way Function (OWF) Assumption #

A one-way function is easy to compute but hard to invert: given f(x), no efficient adversary can find any preimage x' such that f(x') = f(x).

Main definitions #

Cross-Validation #

PropertyThis fileTextbook
OWF GameOWF_GameBS Def. 8.1 / KL Def. 8.1
OWF AdvantageOWF_AdvantagePr[Invert]
OWPOWPDefBS Def. 8.2 (permutation variant)
PRGPRGDefBS Def. 3.1
PRG ⟹ OWFprg_implies_owfBS Thm 8.1

Equivalent formalizations:

Relationship to other assumptions:

References #

One-Way Function #

Abstract one-way function: a function that is easy to compute but hard to invert.

  • f : WW

    The one-way function

Instances For
    @[reducible, inline]

    OWF adversary: given f(x), attempts to find a preimage.

    Equations
    Instances For

      OWF game: sample x, give f(x) to adversary, check if the adversary's output x' satisfies f(x') = f(x).

      Note: the adversary need not find x itself, just any preimage.

      Equations
      Instances For

        One-Way Permutation (OWP) #

        A one-way permutation: a bijective one-way function.

        Instances For

          IsPure Proofs #

          theorem CatCrypt.Crypto.Assumptions.OWF_Game_isPure {W : Type} [Fintype W] [Nonempty W] [DecidableEq W] (F : OWFDef W) (A : OWF_Adversary W) (hA : ∀ (y : W), (A y).IsPure) :

          Pseudorandom Generator (PRG) #

          A PRG stretches a short seed into a longer (or same-length) output that is computationally indistinguishable from uniform.

          structure CatCrypt.Crypto.Assumptions.PRGDef (Seed Output : Type) :

          Abstract pseudorandom generator: a deterministic function from seeds to outputs.

          • stretch : SeedOutput

            The stretch function

          Instances For
            noncomputable def CatCrypt.Crypto.Assumptions.prg_real {Seed Output : Type} [Fintype Seed] [Nonempty Seed] (G : PRGDef Seed Output) :

            PRG real game: sample a seed, output G(seed).

            Equations
            Instances For
              noncomputable def CatCrypt.Crypto.Assumptions.prg_ideal {Output : Type} [Fintype Output] [Nonempty Output] :

              PRG ideal game: sample output uniformly.

              Equations
              Instances For
                @[reducible, inline]

                PRG adversary: a distinguisher that receives a sample and outputs a bit.

                Equations
                Instances For
                  noncomputable def CatCrypt.Crypto.Assumptions.PRG_Advantage {Seed Output : Type} [Fintype Seed] [Nonempty Seed] [Fintype Output] [Nonempty Output] (G : PRGDef Seed Output) (A : PRG_Adversary Output) :

                  PRG advantage: ability to distinguish G(seed) from random.

                  Equations
                  Instances For
                    def CatCrypt.Crypto.Assumptions.PRGSecure {Seed Output : Type} [Fintype Seed] [Nonempty Seed] [Fintype Output] [Nonempty Output] (G : PRGDef Seed Output) (ε : ENNReal) :

                    PRG security assumption.

                    Equations
                    Instances For

                      PRG ⟹ OWF Reduction #

                      If G : Seed → Output is a PRG (pseudorandom generator), then G is also a one-way function on Seed (when Output = Seed). The reduction: an OWF inverter for G would distinguish real from random, since the preimage reveals the seed.

                      BS Thm 8.1: if G is a secure PRG, then G is a secure OWF.

                      Reduction idea. Given an OWF adversary A_owf that inverts G, construct a PRG distinguisher A_prg as follows:

                      1. Receive challenge y (either G(s) for random s, or truly random)
                      2. Run A_owf(y) to get candidate seed s'
                      3. Output decide (G(s') = y)

                      If y = G(s) (real case), then A_owf succeeds with noticeable probability, so A_prg outputs true. If y is random, G(s') = y is unlikely since G's image is sparse in the output space.

                      The bound: OWF_Advantage G A_owf ≤ PRG_Advantage G A_prg.

                      def CatCrypt.Crypto.Assumptions.owf_of_prg {S : Type} (stretch : SS) :

                      Construct an OWF from a PRG stretch function (same-type case).

                      Given PRG G : S → S, define f = G. For PRGs with distinct seed/output types, the one-wayness notion applies on the seed space viewed as the domain.

                      Equations
                      Instances For

                        Construct a PRG distinguisher from an OWF inverter.

                        Given an OWF adversary A_owf that tries to invert G:

                        1. Receive challenge y
                        2. Run A_owf(y) to get candidate preimage s'
                        3. Output true iff G(s') = y

                        In the real game (y = G(s)), A_owf succeeds iff it finds a preimage. In the ideal game (y random), the output is essentially random.

                        Equations
                        Instances For

                          PRG ⟹ OWF reduction bound (Bertie pattern, BS Thm 8.1).

                          The tight bound requires image sparsity: for same-type PRGs (W → W), the OWF advantage includes a |im(G)|/|W| term for the probability of inverting a truly random value. This is provided as a typeclass.

                          Instances

                            Corollary: PRG security implies OWF security.

                            If G is ε-PRG-secure, then owf_of_prg G.stretch is ε-OWF-secure.

                            RSA as OWP #

                            The RSA function (modular exponentiation x ↦ x^e mod N for suitable (N, e)) is conjectured to be a one-way permutation. The formal connection is via RSADef in Assumptions/RSA.lean. An OWPDef instance for RSA would require proving Function.Bijective for the RSA map, which needs number-theoretic facts about the RSA group structure.