pub trait Group: Copy + ScalarOps + ElementOps + 'static {
    fn mul_generator(k: &Self::Scalar) -> Self::Element { ... }
    fn vartime_mul_generator(k: &Self::Scalar) -> Self::Element { ... }
    fn multi_mul<'a, I, J>(scalars: I, elements: J) -> Self::Element
    where
        I: IntoIterator<Item = &'a Self::Scalar>,
        J: IntoIterator<Item = Self::Element>
, { ... } fn vartime_double_mul_generator(
        k: &Self::Scalar,
        k_element: Self::Element,
        r: &Self::Scalar
    ) -> Self::Element { ... } fn vartime_multi_mul<'a, I, J>(scalars: I, elements: J) -> Self::Element
    where
        I: IntoIterator<Item = &'a Self::Scalar>,
        J: IntoIterator<Item = Self::Element>
, { ... } }
Expand description

Prime-order group in which the discrete log problem and decisional / computational Diffie–Hellman problems are believed to be hard.

Groups conforming to this trait can be used for ElGamal encryption and other cryptographic protocols defined in this crate.

This crate provides the following implementations of this trait:

  • Curve25519Subgroup, representation of a prime-order subgroup of Curve25519 with the conventionally chosen generator.
  • Ristretto, a transform of Curve25519 which eliminates its co-factor 8 with the help of the eponymous technique.
  • Generic implementation defined in terms of traits from the elliptic-curve crate. (For example, this means secp256k1 support via the k256 crate.)

Provided Methods

Multiplies the provided scalar by ElementOps::generator(). This operation must be constant-time.

Default implementation

Implemented using Mul (which is constant-time as per the ElementOps contract).

Multiplies the provided scalar by ElementOps::generator(). Unlike Self::mul_generator(), this operation does not need to be constant-time; thus, it may employ additional optimizations.

Default implementation

Implemented by calling Self::mul_generator().

Multiplies provided scalars by elements. This operation must be constant-time w.r.t. the given length of elements.

Default implementation

Implemented by straightforward computations, which are constant-time as per the ElementOps contract.

Calculates k * k_element + r * G, where G is the group generator. This operation does not need to be constant-time.

Default implementation

Implemented by straightforward arithmetic.

Multiplies provided scalars by elements. Unlike Self::multi_mul(), this operation does not need to be constant-time; thus, it may employ additional optimizations.

Default implementation

Implemented by calling Self::multi_mul().

Implementors