Trait snarkvm_curves::traits::pairing_engine::AffineCurve[][src]

pub trait AffineCurve: Eq + Sized + ToBytes + FromBytes + CanonicalSerialize + ConstantSerializedSize + CanonicalDeserialize + Copy + Clone + Default + Send + Sync + Hash + Debug + Display + Neg<Output = Self> + Zero + 'static + From<Self::Projective> {
    type ScalarField: PrimeField + SquareRootField + Into<<Self::ScalarField as PrimeField>::BigInteger>;
    type BaseField: Field;
    type Projective: ProjectiveCurve<Affine = Self, ScalarField = Self::ScalarField> + From<Self> + Into<Self>;
#[must_use]    fn prime_subgroup_generator() -> Self;
fn from_x_coordinate(x: Self::BaseField, greatest: bool) -> Option<Self>;
fn from_y_coordinate(y: Self::BaseField, greatest: bool) -> Option<Self>;
fn add(self, other: &Self) -> Self;
#[must_use] fn mul<S: Into<<Self::ScalarField as PrimeField>::BigInteger>>(
        &self,
        other: S
    ) -> Self::Projective;
#[must_use] fn mul_by_cofactor_to_projective(&self) -> Self::Projective;
#[must_use] fn into_projective(&self) -> Self::Projective;
fn from_random_bytes(bytes: &[u8]) -> Option<Self>;
#[must_use] fn mul_by_cofactor_inv(&self) -> Self;
#[must_use] fn is_in_correct_subgroup_assuming_on_curve(&self) -> bool;
#[must_use] fn to_x_coordinate(&self) -> Self::BaseField;
#[must_use] fn to_y_coordinate(&self) -> Self::BaseField;
fn is_on_curve(&self) -> bool; #[must_use] fn mul_by_cofactor(&self) -> Self { ... } }

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

Associated Types

type ScalarField: PrimeField + SquareRootField + Into<<Self::ScalarField as PrimeField>::BigInteger>[src]

type BaseField: Field[src]

type Projective: ProjectiveCurve<Affine = Self, ScalarField = Self::ScalarField> + From<Self> + Into<Self>[src]

Loading content...

Required methods

#[must_use]fn prime_subgroup_generator() -> Self[src]

Returns a fixed generator of unknown exponent.

fn from_x_coordinate(x: Self::BaseField, greatest: bool) -> Option<Self>[src]

Attempts to construct an affine point given an x-coordinate. The point is not guaranteed to be in the prime order subgroup.

If and only if greatest is set will the lexicographically largest y-coordinate be selected.

fn from_y_coordinate(y: Self::BaseField, greatest: bool) -> Option<Self>[src]

Attempts to construct an affine point given a y-coordinate. The point is not guaranteed to be in the prime order subgroup.

If and only if greatest is set will the lexicographically largest y-coordinate be selected.

fn add(self, other: &Self) -> Self[src]

Performs the standard addition operation of this element with a given other element.

#[must_use]fn mul<S: Into<<Self::ScalarField as PrimeField>::BigInteger>>(
    &self,
    other: S
) -> Self::Projective
[src]

Performs scalar multiplication of this element with mixed addition.

#[must_use]fn mul_by_cofactor_to_projective(&self) -> Self::Projective[src]

Multiply this element by the cofactor and output the resulting projective element.

#[must_use]fn into_projective(&self) -> Self::Projective[src]

Converts this element into its projective representation.

fn from_random_bytes(bytes: &[u8]) -> Option<Self>[src]

Returns a group element if the set of bytes forms a valid group element, otherwise returns None. This function is primarily intended for sampling random group elements from a hash-function or RNG output.

#[must_use]fn mul_by_cofactor_inv(&self) -> Self[src]

Multiply this element by the inverse of the cofactor modulo the size of Self::ScalarField.

#[must_use]fn is_in_correct_subgroup_assuming_on_curve(&self) -> bool[src]

Checks that the point is in the prime order subgroup given the point on the curve.

#[must_use]fn to_x_coordinate(&self) -> Self::BaseField[src]

Returns the x-coordinate of the point.

#[must_use]fn to_y_coordinate(&self) -> Self::BaseField[src]

Returns the y-coordinate of the point.

fn is_on_curve(&self) -> bool[src]

Checks that the current point is on the elliptic curve.

Loading content...

Provided methods

#[must_use]fn mul_by_cofactor(&self) -> Self[src]

Multiply this element by the cofactor.

Loading content...

Implementors

impl<P: Parameters> AffineCurve for snarkvm_curves::templates::short_weierstrass::short_weierstrass_jacobian::GroupAffine<P>[src]

type BaseField = P::BaseField

type Projective = GroupProjective<P>

type ScalarField = P::ScalarField

fn from_x_coordinate(x: Self::BaseField, greatest: bool) -> Option<Self>[src]

Attempts to construct an affine point given an x-coordinate. The point is not guaranteed to be in the prime order subgroup.

If and only if greatest is set will the lexicographically largest y-coordinate be selected.

fn from_y_coordinate(_y: Self::BaseField, _greatest: bool) -> Option<Self>[src]

Attempts to construct an affine point given a y-coordinate. The point is not guaranteed to be in the prime order subgroup.

If and only if greatest is set will the lexicographically largest y-coordinate be selected.

fn is_on_curve(&self) -> bool[src]

Checks that the current point is on the elliptic curve.

impl<P: Parameters> AffineCurve for snarkvm_curves::templates::short_weierstrass::short_weierstrass_projective::GroupAffine<P>[src]

type BaseField = P::BaseField

type Projective = GroupProjective<P>

type ScalarField = P::ScalarField

fn from_x_coordinate(x: Self::BaseField, greatest: bool) -> Option<Self>[src]

Attempts to construct an affine point given an x-coordinate. The point is not guaranteed to be in the prime order subgroup.

If and only if greatest is set will the lexicographically largest y-coordinate be selected.

fn from_y_coordinate(_y: Self::BaseField, _greatest: bool) -> Option<Self>[src]

Attempts to construct an affine point given a y-coordinate. The point is not guaranteed to be in the prime order subgroup.

If and only if greatest is set will the lexicographically largest y-coordinate be selected.

fn is_on_curve(&self) -> bool[src]

Checks that the current point is on the elliptic curve.

impl<P: Parameters> AffineCurve for snarkvm_curves::templates::twisted_edwards_extended::GroupAffine<P>[src]

type BaseField = P::BaseField

type Projective = GroupProjective<P>

type ScalarField = P::ScalarField

fn from_x_coordinate(x: Self::BaseField, greatest: bool) -> Option<Self>[src]

Attempts to construct an affine point given an x-coordinate. The point is not guaranteed to be in the prime order subgroup.

If and only if greatest is set will the lexicographically largest y-coordinate be selected.

fn from_y_coordinate(y: Self::BaseField, greatest: bool) -> Option<Self>[src]

Attempts to construct an affine point given a y-coordinate. The point is not guaranteed to be in the prime order subgroup.

If and only if greatest is set will the lexicographically largest y-coordinate be selected.

fn is_on_curve(&self) -> bool[src]

Checks that the current point is on the elliptic curve.

Loading content...