Documentation

CslibFrontier.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. Its public group parameters are the triple (p, q, g) of binary numbers; 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 parameter bundle 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. SchnorrGroup.Desc contains the triple together with proofs of these conditions. For example, (23, 11, 2) selects the subgroup of order 11 modulo 23 generated by 2. The fixed family schnorrGroups supplies modular arithmetic algorithms for every such bundle. encDesc encodes just the binary triple, while validity is part of the Lean input type. Nothing here claims efficient generation of valid parameter bundles.

Main definitions #

References #

@[reducible, inline]

The prime modulus p of a raw Schnorr-group description (p, q, g).

@[reducible, inline]

The prime subgroup order q of a raw Schnorr-group description (p, q, g).

@[reducible, inline]

The subgroup generator residue g of a raw Schnorr-group description (p, q, g).

Validity of public Schnorr-group parameters (p, q, g): p and q are prime, and the residue g satisfies 1 < g < p and g ^ q ≡ 1 (mod p).

@[reducible, inline]

Public Schnorr-group parameters (p, q, g) together with validity proofs. A value selects the subgroup of order q modulo p generated by g; for example, (23, 11, 2).

@[reducible, inline]

The prime modulus p of a valid Schnorr-group description (p, q, g).

Instances For
    @[reducible, inline]

    The prime subgroup order q of a valid Schnorr-group description (p, q, g).

    @[reducible, inline]

    The subgroup generator residue g of a valid Schnorr-group description (p, q, g).

    The generator as a unit modulo p.

    @[reducible, inline]

    The Schnorr group of a description, written additively.

    Instances For

      The generator has order dividing q.

      Every element of the Schnorr group has order dividing q.

      The generator is not the identity.

      The generator of the Schnorr group.

      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.

      Distinct elements have distinct encodings.

      Multiplication modulo p of encoded residues.

      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.

      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.

      Encode the public group parameters as the binary triple (p, q, g). The validity proofs in Desc do not contribute bits.

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

      Schnorr groups with efficient operations. This fixes the modular arithmetic algorithms; each d : schnorrGroups.Desc supplies public parameters (p, q, g) and their validity proofs, selecting the subgroup of order q of (ZMod p)ˣ generated by g.