pub trait SWCurveConfig: CurveConfig {
const COEFF_A: Self::BaseField;
const COEFF_B: Self::BaseField;
const GENERATOR: Affine<Self>;
// Provided methods
fn mul_by_a(elem: Self::BaseField) -> Self::BaseField { ... }
fn add_b(elem: Self::BaseField) -> Self::BaseField { ... }
fn is_in_prime_order_subgroup(item: &Affine<Self>) -> bool { ... }
fn clear_cofactor(item: &Affine<Self>) -> Affine<Self> { ... }
fn mul_projective(
base: &Projective<Self>,
scalar: impl BitIteratorBE,
) -> Projective<Self> { ... }
fn mul_affine(
base: &Affine<Self>,
scalar: impl BitIteratorBE,
) -> Projective<Self> { ... }
}Expand description
Constants and convenience functions that collectively define the Short Weierstrass model of the curve.
In this model, the curve equation is y² = x³ + a * x + b, for constants
a and b.
Required Associated Constants§
Provided Methods§
Sourcefn mul_by_a(elem: Self::BaseField) -> Self::BaseField
fn mul_by_a(elem: Self::BaseField) -> Self::BaseField
Helper method for computing elem * Self::COEFF_A.
The default implementation should be overridden only if
the product can be computed faster than standard field multiplication
(eg: via doubling if COEFF_A == 2, or if COEFF_A.is_zero()).
Sourcefn add_b(elem: Self::BaseField) -> Self::BaseField
fn add_b(elem: Self::BaseField) -> Self::BaseField
Helper method for computing elem + Self::COEFF_B.
The default implementation should be overridden only if the sum can be computed faster than standard field addition (eg: via doubling).
Sourcefn is_in_prime_order_subgroup(item: &Affine<Self>) -> bool
fn is_in_prime_order_subgroup(item: &Affine<Self>) -> bool
Check if the provided curve point is in the prime-order subgroup.
The default implementation multiplies item by the order r of the
prime-order subgroup, and checks if the result is zero. If the
curve’s cofactor is one, this check automatically returns true.
Implementors can choose to override this default impl
if the given curve has faster methods
for performing this check (for example, via leveraging curve
isomorphisms).
Sourcefn clear_cofactor(item: &Affine<Self>) -> Affine<Self>
fn clear_cofactor(item: &Affine<Self>) -> Affine<Self>
Performs cofactor clearing. The default method is simply to multiply by the cofactor. Some curves can implement a more efficient algorithm.
Sourcefn mul_projective(
base: &Projective<Self>,
scalar: impl BitIteratorBE,
) -> Projective<Self>
fn mul_projective( base: &Projective<Self>, scalar: impl BitIteratorBE, ) -> Projective<Self>
Default implementation of group multiplication for projective coordinates.
Sourcefn mul_affine(
base: &Affine<Self>,
scalar: impl BitIteratorBE,
) -> Projective<Self>
fn mul_affine( base: &Affine<Self>, scalar: impl BitIteratorBE, ) -> Projective<Self>
Default implementation of group multiplication for affine coordinates.
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.