zksync_pairing

Trait CurveProjective

Source
pub trait CurveProjective:
    PartialEq
    + Eq
    + Sized
    + Copy
    + Clone
    + Send
    + Sync
    + Debug
    + Display
    + Rand
    + 'static {
    type Engine: Engine<Fr = Self::Scalar>;
    type Scalar: PrimeField + SqrtField;
    type Base: SqrtField;
    type Affine: CurveAffine<Projective = Self, Scalar = Self::Scalar, Base = Self::Base>;

Show 18 methods // Required methods fn zero() -> Self; fn one() -> Self; fn is_zero(&self) -> bool; fn batch_normalization(v: &mut [Self]); fn is_normalized(&self) -> bool; fn double(&mut self); fn add_assign(&mut self, other: &Self); fn add_assign_mixed(&mut self, other: &Self::Affine); fn negate(&mut self); fn mul_assign<S: Into<<Self::Scalar as PrimeField>::Repr>>( &mut self, other: S, ); fn into_affine(&self) -> Self::Affine; fn recommended_wnaf_for_scalar( scalar: <Self::Scalar as PrimeField>::Repr, ) -> usize; fn recommended_wnaf_for_num_scalars(num_scalars: usize) -> usize; // Provided methods fn sub_assign(&mut self, other: &Self) { ... } fn as_xyz(&self) -> (&Self::Base, &Self::Base, &Self::Base) { ... } fn into_xyz_unchecked(self) -> (Self::Base, Self::Base, Self::Base) { ... } fn from_xyz_unchecked( _x: Self::Base, _y: Self::Base, _z: Self::Base, ) -> Self { ... } fn from_xyz_checked( _x: Self::Base, _y: Self::Base, _z: Self::Base, ) -> Result<Self, GroupDecodingError> { ... }
}
Expand description

Projective representation of an elliptic curve point guaranteed to be in the correct prime order subgroup.

Required Associated Types§

Source

type Engine: Engine<Fr = Self::Scalar>

Source

type Scalar: PrimeField + SqrtField

Source

type Base: SqrtField

Source

type Affine: CurveAffine<Projective = Self, Scalar = Self::Scalar, Base = Self::Base>

Required Methods§

Source

fn zero() -> Self

Returns the additive identity.

Source

fn one() -> Self

Returns a fixed generator of unknown exponent.

Source

fn is_zero(&self) -> bool

Determines if this point is the point at infinity.

Source

fn batch_normalization(v: &mut [Self])

Normalizes a slice of projective elements so that conversion to affine is cheap.

Source

fn is_normalized(&self) -> bool

Checks if the point is already “normalized” so that cheap affine conversion is possible.

Source

fn double(&mut self)

Doubles this element.

Source

fn add_assign(&mut self, other: &Self)

Adds another element to this element.

Source

fn add_assign_mixed(&mut self, other: &Self::Affine)

Adds an affine element to this element.

Source

fn negate(&mut self)

Negates this element.

Source

fn mul_assign<S: Into<<Self::Scalar as PrimeField>::Repr>>(&mut self, other: S)

Performs scalar multiplication of this element.

Source

fn into_affine(&self) -> Self::Affine

Converts this element into its affine representation.

Source

fn recommended_wnaf_for_scalar( scalar: <Self::Scalar as PrimeField>::Repr, ) -> usize

Recommends a wNAF window table size given a scalar. Always returns a number between 2 and 22, inclusive.

Source

fn recommended_wnaf_for_num_scalars(num_scalars: usize) -> usize

Recommends a wNAF window size given the number of scalars you intend to multiply a base by. Always returns a number between 2 and 22, inclusive.

Provided Methods§

Source

fn sub_assign(&mut self, other: &Self)

Subtracts another element from this element.

Source

fn as_xyz(&self) -> (&Self::Base, &Self::Base, &Self::Base)

Returns references to underlying X, Y and Z coordinates. Users should check for infinity outside of this call

Source

fn into_xyz_unchecked(self) -> (Self::Base, Self::Base, Self::Base)

Returns underlying X, Y and Z coordinates. Users should check for infinity outside of this call

Source

fn from_xyz_unchecked(_x: Self::Base, _y: Self::Base, _z: Self::Base) -> Self

Creates a point from raw X, Y and Z coordinates. Point of infinity is encoded as (0,1,0) by default. On-curve check is NOT performed

Source

fn from_xyz_checked( _x: Self::Base, _y: Self::Base, _z: Self::Base, ) -> Result<Self, GroupDecodingError>

Creates a point from raw X, Y and Z coordinates. Point of infinity is encoded as (0,1,0) by default. On-curve check is performed

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 CurveProjective for zksync_pairing::bls12_381::G1

Source§

impl CurveProjective for zksync_pairing::bls12_381::G2

Source§

impl CurveProjective for zksync_pairing::bn256::G1

Source§

impl CurveProjective for zksync_pairing::bn256::G2

Source§

impl CurveProjective for zksync_pairing::compact_bn256::G1

Source§

impl CurveProjective for zksync_pairing::compact_bn256::G2