snarkvm_console_collections

Trait AffineCurve

Source
pub trait AffineCurve:
    Sized
    + CanonicalSerialize
    + CanonicalDeserialize
    + Copy
    + Clone
    + Debug
    + Display
    + Default
    + FromBytes
    + Send
    + Sync
    + 'static
    + Eq
    + Hash
    + Neg<Output = Self>
    + Uniform
    + PartialEq<Self::Projective>
    + Mul<Self::ScalarField, Output = Self::Projective>
    + Serialize
    + DeserializeOwned
    + ToBytes
    + From<Self::Projective>
    + Zero {
    type Projective: ProjectiveCurve<Affine = Self, ScalarField = Self::ScalarField> + From<Self> + Into<Self>;
    type BaseField: Field + SquareRootField;
    type ScalarField: PrimeField + SquareRootField + Into<<Self::ScalarField as PrimeField>::BigInteger>;
    type Coordinates;

Show 19 methods // Required methods fn from_coordinates(coordinates: Self::Coordinates) -> Option<Self>; fn from_coordinates_unchecked(coordinates: Self::Coordinates) -> Self; fn cofactor() -> &'static [u64]; fn prime_subgroup_generator() -> Self; fn from_x_coordinate(x: Self::BaseField, greatest: bool) -> Option<Self>; fn pair_from_x_coordinate(x: Self::BaseField) -> Option<(Self, Self)>; fn from_y_coordinate(y: Self::BaseField, greatest: bool) -> Option<Self>; fn mul_by_cofactor_to_projective(&self) -> Self::Projective; fn to_projective(&self) -> Self::Projective; fn from_random_bytes(bytes: &[u8]) -> Option<Self>; fn mul_bits(&self, bits: impl Iterator<Item = bool>) -> Self::Projective; fn mul_by_cofactor_inv(&self) -> Self; fn is_in_correct_subgroup_assuming_on_curve(&self) -> bool; fn to_x_coordinate(&self) -> Self::BaseField; fn to_y_coordinate(&self) -> Self::BaseField; fn is_on_curve(&self) -> bool; fn batch_add_loop_1( a: &mut Self, b: &mut Self, half: &Self::BaseField, inversion_tmp: &mut Self::BaseField, ); fn batch_add_loop_2( a: &mut Self, b: Self, inversion_tmp: &mut Self::BaseField, ); // Provided method fn mul_by_cofactor(&self) -> Self { ... }
}
Expand description

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

Required Associated Types§

Required Methods§

Source

fn from_coordinates(coordinates: Self::Coordinates) -> Option<Self>

Initializes a new affine group element from the given coordinates.

Source

fn from_coordinates_unchecked(coordinates: Self::Coordinates) -> Self

Initializes a new affine group element from the given coordinates. Note: The resulting point is not enforced to be on the curve or in the correct subgroup.

Source

fn cofactor() -> &'static [u64]

Returns the cofactor of the curve.

Source

fn prime_subgroup_generator() -> Self

Returns a fixed generator of unknown exponent.

Source

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

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.

Source

fn pair_from_x_coordinate(x: Self::BaseField) -> Option<(Self, Self)>

Attempts to construct both possible affine points given an x-coordinate. Points are not guaranteed to be in the prime order subgroup.

The affine points returned should be in lexicographically growing order.

Calling this should be equivalent (but likely more performant) to (AffineCurve::from_x_coordinate(x, false), AffineCurve::from_x_coordinate(x, true)).

Source

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

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.

Source

fn mul_by_cofactor_to_projective(&self) -> Self::Projective

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

Source

fn to_projective(&self) -> Self::Projective

Converts this element into its projective representation.

Source

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

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.

Source

fn mul_bits(&self, bits: impl Iterator<Item = bool>) -> Self::Projective

Multiply this element by a big-endian boolean representation of an integer.

Source

fn mul_by_cofactor_inv(&self) -> Self

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

Source

fn is_in_correct_subgroup_assuming_on_curve(&self) -> bool

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

Source

fn to_x_coordinate(&self) -> Self::BaseField

Returns the x-coordinate of the point.

Source

fn to_y_coordinate(&self) -> Self::BaseField

Returns the y-coordinate of the point.

Source

fn is_on_curve(&self) -> bool

Checks that the current point is on the elliptic curve.

Source

fn batch_add_loop_1( a: &mut Self, b: &mut Self, half: &Self::BaseField, inversion_tmp: &mut Self::BaseField, )

Performs the first half of batch addition in-place.

Source

fn batch_add_loop_2(a: &mut Self, b: Self, inversion_tmp: &mut Self::BaseField)

Performs the second half of batch addition in-place.

Provided Methods§

Source

fn mul_by_cofactor(&self) -> Self

Multiply this element by the cofactor.

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<P> AffineCurve for snarkvm_curves::templates::short_weierstrass_jacobian::affine::Affine<P>

Source§

impl<P> AffineCurve for snarkvm_curves::templates::twisted_edwards_extended::affine::Affine<P>