Trait sp1_core::utils::ec::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§
const NB_LIMBS: usize = <Self::BaseField>::NB_LIMBS
const NB_WITNESS_LIMBS: usize = <Self::BaseField>::NB_WITNESS_LIMBS
Required Methods§
sourcefn ec_add(p: &AffinePoint<Self>, q: &AffinePoint<Self>) -> AffinePoint<Self>
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.
sourcefn ec_double(p: &AffinePoint<Self>) -> AffinePoint<Self>
fn ec_double(p: &AffinePoint<Self>) -> AffinePoint<Self>
Doubles a point on the curve.
sourcefn ec_generator() -> AffinePoint<Self>
fn ec_generator() -> AffinePoint<Self>
Returns the generator of the curve group for a curve/subgroup of prime order.
sourcefn ec_neutral() -> Option<AffinePoint<Self>>
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.
sourcefn ec_neg(p: &AffinePoint<Self>) -> AffinePoint<Self>
fn ec_neg(p: &AffinePoint<Self>) -> AffinePoint<Self>
Returns the negative of a point on the curve.
Provided Methods§
sourcefn nb_scalar_bits() -> usize
fn nb_scalar_bits() -> usize
Returns the number of bits needed to represent a scalar in the group.
Object Safety§
This trait is not object safe.