ark_test_curves::models::short_weierstrass

Struct Affine

Source
pub struct Affine<P>
where P: SWCurveConfig,
{ /* private fields */ }
Expand description

Affine coordinates for a point on an elliptic curve in short Weierstrass form, over the base field P::BaseField.

Implementations§

Source§

impl<P> Affine<P>
where P: SWCurveConfig,

Source

pub fn new( x: <P as CurveConfig>::BaseField, y: <P as CurveConfig>::BaseField, ) -> Affine<P>

Constructs a group element from x and y coordinates. Performs checks to ensure that the point is on the curve and is in the right subgroup.

Source

pub const fn new_unchecked( x: <P as CurveConfig>::BaseField, y: <P as CurveConfig>::BaseField, ) -> Affine<P>

Constructs a group element from x and y coordinates.

§Warning

Does not perform any checks to ensure the point is in the curve or is in the right subgroup.

Source

pub const fn identity() -> Affine<P>

Source

pub fn get_point_from_x_unchecked( x: <P as CurveConfig>::BaseField, greatest: bool, ) -> Option<Affine<P>>

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

pub fn get_ys_from_x_unchecked( x: <P as CurveConfig>::BaseField, ) -> Option<(<P as CurveConfig>::BaseField, <P as CurveConfig>::BaseField)>

Returns the two possible y-coordinates corresponding to the given x-coordinate. The corresponding points are not guaranteed to be in the prime-order subgroup, but are guaranteed to be on the curve. That is, this method returns None if the x-coordinate corresponds to a non-curve point.

The results are sorted by lexicographical order. This means that, if P::BaseField: PrimeField, the results are sorted as integers.

Source

pub fn is_on_curve(&self) -> bool

Checks if self is a valid point on the curve.

Source

pub fn to_flags(&self) -> SWFlags

Source§

impl<P> Affine<P>
where P: SWCurveConfig,

Source

pub fn is_in_correct_subgroup_assuming_on_curve(&self) -> bool

Checks if self is in the subgroup having order that equaling that of P::ScalarField.

Trait Implementations§

Source§

impl<'a, P> Add<&'a Projective<P>> for Affine<P>
where P: SWCurveConfig,

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: &'a Projective<P>) -> Projective<P>

Performs the + operation. Read more
Source§

impl<P> Add<Projective<P>> for Affine<P>
where P: SWCurveConfig,

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: Projective<P>) -> Projective<P>

Performs the + operation. Read more
Source§

impl<P, T> Add<T> for Affine<P>
where P: SWCurveConfig, T: Borrow<Affine<P>>,

Source§

type Output = Projective<P>

The resulting type after applying the + operator.
Source§

fn add(self, other: T) -> Projective<P>

Performs the + operation. Read more
Source§

impl<P> AffineRepr for Affine<P>
where P: SWCurveConfig,

Source§

fn mul_by_cofactor_to_group(&self) -> <Affine<P> as AffineRepr>::Group

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

Source§

fn clear_cofactor(&self) -> Affine<P>

Performs cofactor clearing. The default method is simply to multiply by the cofactor. Some curves can implement a more efficient algorithm.

Source§

type Config = P

Source§

type BaseField = <P as CurveConfig>::BaseField

The finite field over which this curve is defined.
Source§

type ScalarField = <P as CurveConfig>::ScalarField

Source§

type Group = Projective<P>

The projective representation of points on this curve.
Source§

fn xy( &self, ) -> Option<(<Affine<P> as AffineRepr>::BaseField, <Affine<P> as AffineRepr>::BaseField)>

Returns the x and y coordinates of this affine point.
Source§

fn generator() -> Affine<P>

Returns a fixed generator of unknown exponent.
Source§

fn zero() -> Affine<P>

Returns the point at infinity.
Source§

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

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_bigint(&self, by: impl AsRef<[u64]>) -> <Affine<P> as AffineRepr>::Group

Performs scalar multiplication of this element with mixed addition.
Source§

fn x(&self) -> Option<Self::BaseField>

Returns the x coordinate of this affine point.
Source§

fn y(&self) -> Option<Self::BaseField>

Returns the y coordinate of this affine point.
Source§

fn is_zero(&self) -> bool

Is self the point at infinity?
Source§

fn into_group(self) -> Self::Group

Converts self into the projective representation.
Source§

fn mul_by_cofactor(&self) -> Self

Multiplies this element by the cofactor.
Source§

fn mul_by_cofactor_inv(&self) -> Self

Multiplies this element by the inverse of the cofactor in Self::ScalarField.
Source§

impl<P> CanonicalDeserialize for Affine<P>
where P: SWCurveConfig,

Source§

fn deserialize_with_mode<R>( reader: R, compress: Compress, validate: Validate, ) -> Result<Affine<P>, SerializationError>
where R: Read,

The general deserialize method that takes in customization flags.
Source§

fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>
where R: Read,

Source§

fn deserialize_compressed_unchecked<R>( reader: R, ) -> Result<Self, SerializationError>
where R: Read,

Source§

fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>
where R: Read,

Source§

fn deserialize_uncompressed_unchecked<R>( reader: R, ) -> Result<Self, SerializationError>
where R: Read,

Source§

impl<P> CanonicalSerialize for Affine<P>
where P: SWCurveConfig,

Source§

fn serialize_with_mode<W>( &self, writer: W, compress: Compress, ) -> Result<(), SerializationError>
where W: Write,

The general serialize method that takes in customization flags.
Source§

fn serialized_size(&self, compress: Compress) -> usize

Source§

fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

Source§

fn compressed_size(&self) -> usize

Source§

fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>
where W: Write,

Source§

fn uncompressed_size(&self) -> usize

Source§

impl<P> Clone for Affine<P>

Source§

fn clone(&self) -> Affine<P>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P> Debug for Affine<P>
where P: SWCurveConfig,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<P> Default for Affine<P>
where P: SWCurveConfig,

Source§

fn default() -> Affine<P>

Returns the “default value” for a type. Read more
Source§

impl<P> Display for Affine<P>
where P: SWCurveConfig,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'a, P> From<&'a Affine<<P as BW6Config>::G1Config>> for G1Prepared<P>
where P: BW6Config,

Source§

fn from(other: &'a Affine<<P as BW6Config>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<'a, P> From<&'a Affine<<P as BW6Config>::G2Config>> for G2Prepared<P>
where P: BW6Config,

Source§

fn from(q: &'a Affine<<P as BW6Config>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<'a, P> From<&'a Affine<<P as Bls12Config>::G1Config>> for G1Prepared<P>
where P: Bls12Config,

Source§

fn from(other: &'a Affine<<P as Bls12Config>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<'a, P> From<&'a Affine<<P as Bls12Config>::G2Config>> for G2Prepared<P>
where P: Bls12Config,

Source§

fn from(other: &'a Affine<<P as Bls12Config>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<'a, P> From<&'a Affine<<P as BnConfig>::G1Config>> for G1Prepared<P>
where P: BnConfig,

Source§

fn from(other: &'a Affine<<P as BnConfig>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<'a, P> From<&'a Affine<<P as BnConfig>::G2Config>> for G2Prepared<P>
where P: BnConfig,

Source§

fn from(other: &'a Affine<<P as BnConfig>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<'a, P> From<&'a Affine<<P as MNT4Config>::G1Config>> for G1Prepared<P>
where P: MNT4Config,

Source§

fn from(g1: &'a Affine<<P as MNT4Config>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<'a, P> From<&'a Affine<<P as MNT4Config>::G2Config>> for G2Prepared<P>
where P: MNT4Config,

Source§

fn from(g2: &'a Affine<<P as MNT4Config>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<'a, P> From<&'a Affine<<P as MNT6Config>::G1Config>> for G1Prepared<P>
where P: MNT6Config,

Source§

fn from(g1: &'a Affine<<P as MNT6Config>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<'a, P> From<&'a Affine<<P as MNT6Config>::G2Config>> for G2Prepared<P>
where P: MNT6Config,

Source§

fn from(g2: &'a Affine<<P as MNT6Config>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as BW6Config>::G1Config>> for G1Prepared<P>
where P: BW6Config,

Source§

fn from(other: Affine<<P as BW6Config>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as BW6Config>::G2Config>> for G2Prepared<P>
where P: BW6Config,

Source§

fn from(q: Affine<<P as BW6Config>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as Bls12Config>::G1Config>> for G1Prepared<P>
where P: Bls12Config,

Source§

fn from(other: Affine<<P as Bls12Config>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as Bls12Config>::G2Config>> for G2Prepared<P>
where P: Bls12Config,

Source§

fn from(q: Affine<<P as Bls12Config>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as BnConfig>::G1Config>> for G1Prepared<P>
where P: BnConfig,

Source§

fn from(other: Affine<<P as BnConfig>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as BnConfig>::G2Config>> for G2Prepared<P>
where P: BnConfig,

Source§

fn from(q: Affine<<P as BnConfig>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as MNT4Config>::G1Config>> for G1Prepared<P>
where P: MNT4Config,

Source§

fn from(g1: Affine<<P as MNT4Config>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as MNT4Config>::G2Config>> for G2Prepared<P>
where P: MNT4Config,

Source§

fn from(g: Affine<<P as MNT4Config>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as MNT6Config>::G1Config>> for G1Prepared<P>
where P: MNT6Config,

Source§

fn from(g1: Affine<<P as MNT6Config>::G1Config>) -> G1Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<<P as MNT6Config>::G2Config>> for G2Prepared<P>
where P: MNT6Config,

Source§

fn from(g: Affine<<P as MNT6Config>::G2Config>) -> G2Prepared<P>

Converts to this type from the input type.
Source§

impl<P> From<Affine<P>> for Projective<P>
where P: SWCurveConfig,

Source§

fn from(p: Affine<P>) -> Projective<P>

Converts to this type from the input type.
Source§

impl<P> From<G2HomProjective<P>> for Affine<<P as BW6Config>::G2Config>
where P: BW6Config,

Source§

fn from(q: G2HomProjective<P>) -> Affine<<P as BW6Config>::G2Config>

Converts to this type from the input type.
Source§

impl<P> From<Projective<P>> for Affine<P>
where P: SWCurveConfig,

Source§

fn from(p: Projective<P>) -> Affine<P>

Converts to this type from the input type.
Source§

impl<P> Hash for Affine<P>

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<P, T> Mul<T> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> <Affine<P> as Mul<T>>::Output

Performs the * operation. Read more
Source§

impl<P> Neg for Affine<P>
where P: SWCurveConfig,

Source§

fn neg(self) -> Affine<P>

If self.is_zero(), returns self (== Self::zero()). Else, returns (x, -y), where self = (x, y).

Source§

type Output = Affine<P>

The resulting type after applying the - operator.
Source§

impl<P> PartialEq<Affine<P>> for Projective<P>
where P: SWCurveConfig,

Source§

fn eq(&self, other: &Affine<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P> PartialEq<Projective<P>> for Affine<P>
where P: SWCurveConfig,

Source§

fn eq(&self, other: &Projective<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P> PartialEq for Affine<P>

Source§

fn eq(&self, other: &Affine<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, P> Sub<&'a Projective<P>> for Affine<P>
where P: SWCurveConfig,

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &'a Projective<P>) -> Projective<P>

Performs the - operation. Read more
Source§

impl<P> Sub<Projective<P>> for Affine<P>
where P: SWCurveConfig,

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Projective<P>) -> Projective<P>

Performs the - operation. Read more
Source§

impl<P, T> Sub<T> for Affine<P>
where P: SWCurveConfig, T: Borrow<Affine<P>>,

Source§

type Output = Projective<P>

The resulting type after applying the - operator.
Source§

fn sub(self, other: T) -> Projective<P>

Performs the - operation. Read more
Source§

impl<M, ConstraintF> ToConstraintField<ConstraintF> for Affine<M>
where M: SWCurveConfig, ConstraintF: Field, <M as CurveConfig>::BaseField: ToConstraintField<ConstraintF>,

Source§

fn to_field_elements(&self) -> Option<Vec<ConstraintF>>

Source§

impl<P> Valid for Affine<P>
where P: SWCurveConfig,

Source§

fn check(&self) -> Result<(), SerializationError>

Source§

fn batch_check<'a>( batch: impl Iterator<Item = &'a Self> + Send, ) -> Result<(), SerializationError>
where Self: 'a,

Source§

impl<P> Zeroize for Affine<P>
where P: SWCurveConfig,

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl<P> Copy for Affine<P>

Source§

impl<P> Eq for Affine<P>

Auto Trait Implementations§

§

impl<P> Freeze for Affine<P>
where <P as CurveConfig>::BaseField: Freeze,

§

impl<P> RefUnwindSafe for Affine<P>

§

impl<P> Send for Affine<P>

§

impl<P> Sync for Affine<P>

§

impl<P> Unpin for Affine<P>
where <P as CurveConfig>::BaseField: Unpin,

§

impl<P> UnwindSafe for Affine<P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CanonicalSerializeHashExt for T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UniformRand for T

Source§

fn rand<R>(rng: &mut R) -> T
where R: Rng + ?Sized,

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V