Documentation

CatCryptCore.Examples.SecretSharing

2-out-of-2 Additive Secret Sharing: Perfect Privacy #

The 2-out-of-2 additive (XOR) secret-sharing scheme has perfect privacy: one share alone is uniformly distributed and independent of the shared secret, so an adversary holding a single share has advantage exactly 0 in distinguishing which secret was shared. Following Rosulek, The Joy of Cryptography (secret sharing).

This result is information-theoretic and self-contained — the cleanest possible instance of the bijection-coupling technique.

Overview #

To share a secret bit s, sample a uniform bit k and hand out the two shares

share₁ = k        share₂ = k ⊕ s

Reconstruction is share₁ ⊕ share₂ = k ⊕ (k ⊕ s) = s, so the two shares together determine s. Privacy is the statement that either share on its own reveals nothing about s:

The privacy game reveals the share held by the corrupted party (indexed by a bit i) for one of two adversarially chosen secrets s₀, s₁. For any fixed i, the two games couple through a single uniform sample — for i = true via XOR-by-(s₀ ⊕ s₁), for i = false via the identity — so advantage_zero_of_rHoare collapses the advantage to 0.

Main definitions #

Main results #

References #

The 2-of-2 XOR Sharing #

The share held by corrupted party i, given key k and secret s: party false holds share₁ = k, party true holds share₂ = k ⊕ s.

Equations
Instances For

    The 2-out-of-2 additive (XOR) sharing of a secret bit s: sample a uniform key k; the shares are (k, k ⊕ s).

    Equations
    Instances For

      Reconstruction #

      The two shares reconstruct the secret: share₁ ⊕ share₂ = s.

      The One-Share Privacy Game #

      Privacy game for 2-of-2 XOR sharing. The corrupted party i is handed its single share of one of two adversarially chosen secrets:

      The adversary sees only party i's share and tries to tell the two apart.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Privacy advantage: the corrupted party's distinguishing probability between a share of s₀ and a share of s₁.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Perfect Privacy #

          noncomputable def CatCrypt.Examples.SecretSharing.shareBij (i s₀ s₁ : Bool) :

          The key-remap bijection coupling the two privacy games. For the corrupted party i, it maps the key used to share s₀ to the key sharing s₁ while keeping party i's revealed share fixed: XOR-by-(s₀ ⊕ s₁) when i = true, the identity when i = false.

          Equations
          Instances For

            Coupling: for a fixed corrupted party, the two privacy games are equidistributed. The revealed share over a uniform key is equidistributed with a plain uniform sample (XOR-by-a-fixed-value is a bijection of the key, the identity when the plain share is revealed), so the two games couple by transitivity through the uniform sample.

            2-of-2 XOR secret sharing has perfect privacy: for either corrupted party i, any two secrets s₀, s₁, and any adversary A, the one-share privacy advantage is exactly 0. A single share is uniform and independent of the secret.

            Reflection into the Package / UC Stack #

            The shallow ss_perfect_privacy bounds a single distinguisher applied to the two privacy-game bodies. This section lifts it to a composable statement about deep nominal packages linked with an arbitrary adversary package, following the stack shallow game → rawCode% → NomPackage.ofOracle → DeepNomAdvantage → sdist → UC via the shared CatCryptCore.Deep.ReflectUCHelpers combinators. The privacy game is heap-independent, so the shallow coupling ss_privacy_coupling upgrades to a full SPComp equality of the two reflected bodies (spcomp_eq_of_isPure_coupling), and the whole stack follows with no purity bridge on the adversary.

            The reflected one-share privacy-game body for corrupted party i and bit b.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem CatCrypt.Examples.SecretSharing.ssGameRaw_eval_shallow (i s₀ s₁ b : Bool) :
              (ssGameRaw i s₀ s₁ b).eval = SS_Privacy_Game i s₀ s₁ b

              The reflected body evaluates back to the shallow privacy game.

              The privacy game is heap-independent (a uniform sample then a pure reveal).

              theorem CatCrypt.Examples.SecretSharing.ssGameRaw_eval_eq (i s₀ s₁ : Bool) :
              (ssGameRaw i s₀ s₁ true).eval = (ssGameRaw i s₀ s₁ false).eval

              The two reflected bodies (share of s₀ vs. s₁) have equal evaluations: the heap-independent coupling ss_privacy_coupling upgrades to SPComp equality.

              Real privacy game as an oracle-exporting nominal package (shares s₀).

              Equations
              Instances For

                Ideal privacy game as an oracle-exporting nominal package (shares s₁).

                Equations
                Instances For

                  Zero deep-nominal advantage against every adversary package.

                  theorem CatCrypt.Examples.SecretSharing.ss_sdist_zero (i s₀ s₁ : Bool) :
                  (Crypto.sdist (fun (A : Deep.NomPackage) => Crypto.runPkg (A.pkg.link (ssGameTrue i s₀ s₁).pkg)) fun (A : Deep.NomPackage) => Crypto.runPkg (A.pkg.link (ssGameFalse i s₀ s₁).pkg)) = 0

                  Statistical distance zero between the two linked-game families.

                  theorem CatCrypt.Examples.SecretSharing.ss_nompkg_secure (i s₀ s₁ : Bool) :
                  Crypto.NomPkgSecure (ssGameTrue i s₀ s₁) (ssGameFalse i s₀ s₁) fun (x : Deep.NomPackage) => 0

                  Package-level perfect privacy (NomPkgSecure).

                  theorem CatCrypt.Examples.SecretSharing.ss_uc (i s₀ s₁ : Bool) :
                  Crypto.UCEmulates 0 { hon := Deep.NomPackage, out := Bool, leak := Empty, sim_if := Empty, view := Bool } (fun (A : { hon := Deep.NomPackage, out := Bool, leak := Empty, sim_if := Empty, view := Bool }.hon) => Core.SPComp.map Sum.inl (Crypto.runPkg (A.pkg.link (ssGameTrue i s₀ s₁).pkg))) fun (A : { hon := Deep.NomPackage, out := Bool, leak := Empty, sim_if := Empty, view := Bool }.hon) => Core.SPComp.map Sum.inl (Crypto.runPkg (A.pkg.link (ssGameFalse i s₀ s₁).pkg))

                  Perfect UC emulation of the linked-game families over the trivial-leak interface (out = Bool, leak = Empty) with the identity simulator (composition plumbing).

                  Reflection mirrors the shallow game. Against the forwarding adversary, the deep-nominal advantage equals the shallow privacy advantage under the identity distinguisher — which is 0 by ss_perfect_privacy.