Documentation

Complexity.Crypto.Computational.DiscreteLog.SchnorrGroup

Schnorr groups #

A Schnorr group is the subgroup of prime order q of (ZMod p)ˣ, for a prime p, generated by a residue g of multiplicative order q. It is described by the triple (p, q, g) of binary numbers, and its elements are encoded by the binary digits of their residues. Multiplication and exponentiation are computed modulo p, by schoolbook multiplication and square-and-multiply. These groups form a PrimeOrderGroupFamily, so the discrete-logarithm assumption and the security theorems stated for such families apply to them.

A description is valid when p and q are prime, 1 < g < p and g ^ q % p = 1; these facts imply that g has order q and that q divides p - 1. Validity is part of the description type: algorithms receive only valid descriptions, and nothing here claims that valid descriptions can be generated efficiently.

Main definitions #

References #

A valid description (p, q, g) of a Schnorr group: p and q are prime, and the residue g satisfies 1 < g < p and g ^ q ≡ 1 (mod p).

  • prime_modulus : Nat.Prime d.1

    The modulus is prime.

  • prime_order : Nat.Prime d.2.1

    The group order is prime.

  • one_lt_generator : 1 < d.2.2

    The generator is not 0 or 1.

  • generator_lt : d.2.2 < d.1

    The generator is a reduced residue.

  • generator_pow : d.2.2 ^ d.2.1 % d.1 = 1

    The generator has order dividing q.

Instances For
    @[reducible, inline]

    Valid Schnorr-group descriptions.

    Instances For

      The generator as a unit modulo p.

      Instances For
        @[reducible, inline]

        The Schnorr group of a description, written additively.

        Instances For

          The generator has order dividing q.

          theorem Cslib.Crypto.SchnorrGroup.pow_order (d : Desc) (x : ↥(Subgroup.zpowers (generatorUnit d))) :
          x ^ (↑d).2.1 = 1

          Every element of the Schnorr group has order dividing q.

          The generator is not the identity.

          The generator of the Schnorr group.

          Instances For

            The Schnorr group has q elements.

            The generator is not the identity of the Schnorr group.

            Elements are encoded by the binary digits of their residues modulo p.

            Instances For

              Distinct elements have distinct encodings.

              Multiplication modulo p of encoded residues.

              Instances For
                theorem Cslib.Crypto.SchnorrGroup.add_encode (d : Desc) (x y : Carrier d) :
                add (d, encode d x, encode d y) = encode d (x + y)

                add multiplies encoded group elements.

                Exponentiation modulo p of an encoded residue.

                Instances For
                  theorem Cslib.Crypto.SchnorrGroup.smul_encode (d : Desc) (a : ℕ) (x : Carrier d) :
                  smul (d, a, encode d x) = encode d (↑a • x)

                  smul raises encoded group elements to natural powers.

                  The encoded generator is the binary digits of g.

                  Descriptions are encoded as the binary triple (p, q, g).

                  Instances For

                    The group order is computable in polynomial time from the description.

                    The encoded generator is computable in polynomial time from the description.

                    Schnorr groups, the subgroups of prime order q of (ZMod p)ˣ, as a family of cyclic groups of prime order with efficient operations.

                    Instances For