EllipticCurve

Trait EllipticCurve 

Source
pub trait EllipticCurve: EllipticCurveParameters {
    const NB_LIMBS: usize = <Self::BaseField>::NB_LIMBS;
    const NB_WITNESS_LIMBS: usize = <Self::BaseField>::NB_WITNESS_LIMBS;

    // Required methods
    fn ec_add(p: &AffinePoint<Self>, q: &AffinePoint<Self>) -> AffinePoint<Self>;
    fn ec_double(p: &AffinePoint<Self>) -> AffinePoint<Self>;
    fn ec_generator() -> AffinePoint<Self>;
    fn ec_neutral() -> Option<AffinePoint<Self>>;
    fn ec_neg(p: &AffinePoint<Self>) -> AffinePoint<Self>;

    // Provided method
    fn nb_scalar_bits() -> usize { ... }
}
Expand description

An interface for elliptic curve groups.

Provided Associated Constants§

Source

const NB_LIMBS: usize = <Self::BaseField>::NB_LIMBS

Source

const NB_WITNESS_LIMBS: usize = <Self::BaseField>::NB_WITNESS_LIMBS

Required Methods§

Source

fn ec_add(p: &AffinePoint<Self>, q: &AffinePoint<Self>) -> AffinePoint<Self>

Adds two different points on the curve.

Warning: This method assumes that the two points are different.

Source

fn ec_double(p: &AffinePoint<Self>) -> AffinePoint<Self>

Doubles a point on the curve.

Source

fn ec_generator() -> AffinePoint<Self>

Returns the generator of the curve group for a curve/subgroup of prime order.

Source

fn ec_neutral() -> Option<AffinePoint<Self>>

Returns the neutral element of the curve group, if this element is affine (such as in the case of the Edwards curve group). Otherwise, returns None.

Source

fn ec_neg(p: &AffinePoint<Self>) -> AffinePoint<Self>

Returns the negative of a point on the curve.

Provided Methods§

Source

fn nb_scalar_bits() -> usize

Returns the number of bits needed to represent a scalar in the group.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<E: EdwardsParameters> EllipticCurve for EdwardsCurve<E>

Source§

impl<E: WeierstrassParameters> EllipticCurve for SwCurve<E>

Source§

const NB_LIMBS: usize = <Self::BaseField>::NB_LIMBS

Source§

const NB_WITNESS_LIMBS: usize = <Self::BaseField>::NB_WITNESS_LIMBS