Type Alias G1Affine

Source
pub type G1Affine<P> = Affine<<P as MNT4Config>::G1Config>;

Aliased Type§

struct G1Affine<P> { /* private fields */ }

Implementations

Source§

impl<P: SWCurveConfig> Affine<P>

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.

Source§

impl<P: SWCurveConfig> Affine<P>

Source

pub fn new(x: P::BaseField, y: P::BaseField) -> Self

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::BaseField, y: P::BaseField) -> Self

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() -> Self

Source

pub fn get_point_from_x_unchecked( x: P::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

pub fn get_ys_from_x_unchecked( x: P::BaseField, ) -> Option<(P::BaseField, P::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

Trait Implementations

Source§

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

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: SWCurveConfig> Add<Projective<P>> for Affine<P>

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: SWCurveConfig, T: Borrow<Self>> Add<T> for 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: SWCurveConfig> AffineRepr for Affine<P>

Source§

fn mul_by_cofactor_to_group(&self) -> Self::Group

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

Source§

fn clear_cofactor(&self) -> Self

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<(Self::BaseField, Self::BaseField)>

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

fn generator() -> Self

Returns a fixed generator of unknown exponent.
Source§

fn zero() -> Self

Returns the point at infinity.
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_bigint(&self, by: impl AsRef<[u64]>) -> Self::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: SWCurveConfig> CanonicalDeserialize for Affine<P>

Source§

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

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: SWCurveConfig> CanonicalSerialize for Affine<P>

Source§

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

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: SWCurveConfig> Clone for Affine<P>
where P::BaseField: Copy, bool: Copy,

Source§

fn clone(&self) -> Self

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: SWCurveConfig> Debug for Affine<P>

Source§

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

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

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

Source§

fn default() -> Self

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

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

Source§

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

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

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

Source§

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

Converts to this type from the input type.
Source§

impl<P: SWCurveConfig> Hash for Affine<P>
where P::BaseField: Hash, bool: Hash,

Source§

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

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: SWCurveConfig, T: Borrow<P::ScalarField>> Mul<T> for Affine<P>

Source§

type Output = Projective<P>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Self::Output

Performs the * operation. Read more
Source§

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

Source§

fn neg(self) -> Self

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: SWCurveConfig> PartialEq<Projective<P>> for Affine<P>

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: SWCurveConfig> PartialEq for Affine<P>

Source§

fn eq(&self, other: &Self) -> 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: SWCurveConfig> Sub<&'a Projective<P>> for Affine<P>

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: SWCurveConfig> Sub<Projective<P>> for Affine<P>

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: SWCurveConfig, T: Borrow<Self>> Sub<T> for 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: SWCurveConfig, ConstraintF: Field> ToConstraintField<ConstraintF> for Affine<M>
where M::BaseField: ToConstraintField<ConstraintF>,

Source§

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

Source§

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

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: SWCurveConfig> Zeroize for Affine<P>

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: SWCurveConfig> Copy for Affine<P>
where P::BaseField: Copy, bool: Copy,

Source§

impl<P: SWCurveConfig> Eq for Affine<P>