Documentation

QedShare.Encoding.Token

Share tokens (share format qs3) #

The AMD tag (Amd.lean) checks the rebuilt bytes. That is not enough with exactly k shares: forgers who hold k − 1 shares can hand in a share under a new index chosen so that the honest shares cancel out, and then the rebuilt bytes do not depend on the secret at all (README: Forged shares). So each share is also checked on its own:

Forgers holding k − 1 shares know G at k − 1 points, so G(z) at any other index is uniformly random to them. Whatever they do, either an honest token or a forged one has to be guessed, or they only use indices they hold, and then the AMD tag catches the change. The proof is combine_detects_forgery_tok in proofs/.

G(z) by Horner's rule; G lists the coefficients from g₀ up.

Equations
Instances For

    The token of the share at index i: G(i), with i read in GF(2¹²⁸).

    Equations
    Instances For

      The coefficients of G as bytes, 16 per coefficient.

      Equations
      Instances For

        Read k coefficients from bytes (16 each).

        Equations
        Instances For

          The bytes that get split: Amd.encode (s ‖ G) x.

          Equations
          Instances For

            Do all tokens match G? Every comparison is made (no early exit), each in constant time.

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

              Check the rebuilt bytes e of a threshold-k split against the given (index, token) pairs: the AMD tag must pass, and every token must match the G read from e. Returns the secret, or none.

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

                combine followed by decode: shares with their tokens in, the secret out (or none).

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

                  The tokens of the shares at xs.

                  Equations
                  Instances For

                    Round trip #

                    coeffBytes has 16 bytes per coefficient.

                    Reading back the coefficients of G gives G.

                    Matching tokens pass the check.

                    theorem QedShare.Token.decode_encode (s : List GF256) (G : List GF2_128) (x : GF2_128) (xs : List GF256) :
                    decode G.length (encode s G x) (xs.zip (tokens G xs)) = some s

                    Round trip. Rebuilt bytes of a correct encoding, with the right tokens, decode to the secret.