Struct ark_ec::models::short_weierstrass::Affine
source · pub struct Affine<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: SWCurveConfig> Affine<P>
impl<P: SWCurveConfig> Affine<P>
sourcepub fn new(x: P::BaseField, y: P::BaseField) -> Self
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.
sourcepub const fn new_unchecked(x: P::BaseField, y: P::BaseField) -> Self
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.
pub const fn identity() -> Self
sourcepub fn get_point_from_x_unchecked(
x: P::BaseField,
greatest: bool
) -> Option<Self>
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.
sourcepub fn get_ys_from_x_unchecked(
x: P::BaseField
) -> Option<(P::BaseField, P::BaseField)>
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.
sourcepub fn is_on_curve(&self) -> bool
pub fn is_on_curve(&self) -> bool
Checks if self
is a valid point on the curve.
pub fn to_flags(&self) -> SWFlags
source§impl<P: SWCurveConfig> Affine<P>
impl<P: SWCurveConfig> Affine<P>
sourcepub fn is_in_correct_subgroup_assuming_on_curve(&self) -> bool
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: SWCurveConfig> Add<&'a Projective<P>> for Affine<P>
impl<'a, P: SWCurveConfig> Add<&'a Projective<P>> for Affine<P>
§type Output = Projective<P>
type Output = Projective<P>
+
operator.source§fn add(self, other: &'a Projective<P>) -> Projective<P>
fn add(self, other: &'a Projective<P>) -> Projective<P>
+
operation. Read moresource§impl<P: SWCurveConfig> Add<Projective<P>> for Affine<P>
impl<P: SWCurveConfig> Add<Projective<P>> for Affine<P>
§type Output = Projective<P>
type Output = Projective<P>
+
operator.source§fn add(self, other: Projective<P>) -> Projective<P>
fn add(self, other: Projective<P>) -> Projective<P>
+
operation. Read moresource§impl<P: SWCurveConfig, T: Borrow<Self>> Add<T> for Affine<P>
impl<P: SWCurveConfig, T: Borrow<Self>> Add<T> for Affine<P>
§type Output = Projective<P>
type Output = Projective<P>
+
operator.source§fn add(self, other: T) -> Projective<P>
fn add(self, other: T) -> Projective<P>
+
operation. Read moresource§impl<P: SWCurveConfig> AffineRepr for Affine<P>
impl<P: SWCurveConfig> AffineRepr for Affine<P>
source§fn mul_by_cofactor_to_group(&self) -> Self::Group
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
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.
type Config = P
§type BaseField = <P as CurveConfig>::BaseField
type BaseField = <P as CurveConfig>::BaseField
type ScalarField = <P as CurveConfig>::ScalarField
§type Group = Projective<P>
type Group = Projective<P>
source§fn xy(&self) -> Option<(&Self::BaseField, &Self::BaseField)>
fn xy(&self) -> Option<(&Self::BaseField, &Self::BaseField)>
source§fn from_random_bytes(bytes: &[u8]) -> Option<Self>
fn from_random_bytes(bytes: &[u8]) -> Option<Self>
source§fn mul_bigint(&self, by: impl AsRef<[u64]>) -> Self::Group
fn mul_bigint(&self, by: impl AsRef<[u64]>) -> Self::Group
source§fn into_group(self) -> Self::Group
fn into_group(self) -> Self::Group
source§fn mul_by_cofactor(&self) -> Self
fn mul_by_cofactor(&self) -> Self
source§fn mul_by_cofactor_inv(&self) -> Self
fn mul_by_cofactor_inv(&self) -> Self
Self::ScalarField
.source§impl<P: SWCurveConfig> CanonicalDeserialize for Affine<P>
impl<P: SWCurveConfig> CanonicalDeserialize for Affine<P>
source§fn deserialize_with_mode<R: Read>(
reader: R,
compress: Compress,
validate: Validate
) -> Result<Self, SerializationError>
fn deserialize_with_mode<R: Read>( reader: R, compress: Compress, validate: Validate ) -> Result<Self, SerializationError>
fn deserialize_compressed<R>(reader: R) -> Result<Self, SerializationError>where R: Read,
fn deserialize_compressed_unchecked<R>( reader: R ) -> Result<Self, SerializationError>where R: Read,
fn deserialize_uncompressed<R>(reader: R) -> Result<Self, SerializationError>where R: Read,
fn deserialize_uncompressed_unchecked<R>( reader: R ) -> Result<Self, SerializationError>where R: Read,
source§impl<P: SWCurveConfig> CanonicalSerialize for Affine<P>
impl<P: SWCurveConfig> CanonicalSerialize for Affine<P>
source§fn serialize_with_mode<W: Write>(
&self,
writer: W,
compress: Compress
) -> Result<(), SerializationError>
fn serialize_with_mode<W: Write>( &self, writer: W, compress: Compress ) -> Result<(), SerializationError>
fn serialized_size(&self, compress: Compress) -> usize
fn serialize_compressed<W>(&self, writer: W) -> Result<(), SerializationError>where W: Write,
fn compressed_size(&self) -> usize
fn serialize_uncompressed<W>(&self, writer: W) -> Result<(), SerializationError>where W: Write,
fn uncompressed_size(&self) -> usize
source§impl<P> Clone for Affine<P>where
P: SWCurveConfig,
impl<P> Clone for Affine<P>where P: SWCurveConfig,
source§impl<P: SWCurveConfig> Debug for Affine<P>
impl<P: SWCurveConfig> Debug for Affine<P>
source§impl<P: SWCurveConfig> Default for Affine<P>
impl<P: SWCurveConfig> Default for Affine<P>
source§impl<P: SWCurveConfig> Display for Affine<P>
impl<P: SWCurveConfig> Display for Affine<P>
source§impl<P: SWCurveConfig> Distribution<Affine<P>> for Standard
impl<P: SWCurveConfig> Distribution<Affine<P>> for Standard
source§fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Affine<P>
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Affine<P>
Generates a uniformly random instance of the curve.
source§impl<'a, P: Bls12Config> From<&'a Affine<<P as Bls12Config>::G1Config>> for G1Prepared<P>
impl<'a, P: Bls12Config> From<&'a Affine<<P as Bls12Config>::G1Config>> for G1Prepared<P>
source§impl<'a, P: Bls12Config> From<&'a Affine<<P as Bls12Config>::G2Config>> for G2Prepared<P>
impl<'a, P: Bls12Config> From<&'a Affine<<P as Bls12Config>::G2Config>> for G2Prepared<P>
source§impl<'a, P: MNT4Config> From<&'a Affine<<P as MNT4Config>::G1Config>> for G1Prepared<P>
impl<'a, P: MNT4Config> From<&'a Affine<<P as MNT4Config>::G1Config>> for G1Prepared<P>
source§impl<'a, P: MNT4Config> From<&'a Affine<<P as MNT4Config>::G2Config>> for G2Prepared<P>
impl<'a, P: MNT4Config> From<&'a Affine<<P as MNT4Config>::G2Config>> for G2Prepared<P>
source§impl<'a, P: MNT6Config> From<&'a Affine<<P as MNT6Config>::G1Config>> for G1Prepared<P>
impl<'a, P: MNT6Config> From<&'a Affine<<P as MNT6Config>::G1Config>> for G1Prepared<P>
source§impl<'a, P: MNT6Config> From<&'a Affine<<P as MNT6Config>::G2Config>> for G2Prepared<P>
impl<'a, P: MNT6Config> From<&'a Affine<<P as MNT6Config>::G2Config>> for G2Prepared<P>
source§impl<P: Bls12Config> From<Affine<<P as Bls12Config>::G1Config>> for G1Prepared<P>
impl<P: Bls12Config> From<Affine<<P as Bls12Config>::G1Config>> for G1Prepared<P>
source§impl<P: Bls12Config> From<Affine<<P as Bls12Config>::G2Config>> for G2Prepared<P>
impl<P: Bls12Config> From<Affine<<P as Bls12Config>::G2Config>> for G2Prepared<P>
source§impl<P: MNT4Config> From<Affine<<P as MNT4Config>::G1Config>> for G1Prepared<P>
impl<P: MNT4Config> From<Affine<<P as MNT4Config>::G1Config>> for G1Prepared<P>
source§impl<P: MNT4Config> From<Affine<<P as MNT4Config>::G2Config>> for G2Prepared<P>
impl<P: MNT4Config> From<Affine<<P as MNT4Config>::G2Config>> for G2Prepared<P>
source§impl<P: MNT6Config> From<Affine<<P as MNT6Config>::G1Config>> for G1Prepared<P>
impl<P: MNT6Config> From<Affine<<P as MNT6Config>::G1Config>> for G1Prepared<P>
source§impl<P: MNT6Config> From<Affine<<P as MNT6Config>::G2Config>> for G2Prepared<P>
impl<P: MNT6Config> From<Affine<<P as MNT6Config>::G2Config>> for G2Prepared<P>
source§impl<P: SWCurveConfig> From<Affine<P>> for Projective<P>
impl<P: SWCurveConfig> From<Affine<P>> for Projective<P>
source§fn from(p: Affine<P>) -> Projective<P>
fn from(p: Affine<P>) -> Projective<P>
source§impl<P: SWCurveConfig> From<Projective<P>> for Affine<P>
impl<P: SWCurveConfig> From<Projective<P>> for Affine<P>
source§fn from(p: Projective<P>) -> Affine<P>
fn from(p: Projective<P>) -> Affine<P>
source§impl<P> Hash for Affine<P>where
P: SWCurveConfig,
impl<P> Hash for Affine<P>where P: SWCurveConfig,
source§impl<P: SWCurveConfig, T: Borrow<P::ScalarField>> Mul<T> for Affine<P>
impl<P: SWCurveConfig, T: Borrow<P::ScalarField>> Mul<T> for Affine<P>
source§impl<P: SWCurveConfig> Neg for Affine<P>
impl<P: SWCurveConfig> Neg for Affine<P>
source§impl<P> PartialEq<Affine<P>> for Affine<P>where
P: SWCurveConfig,
impl<P> PartialEq<Affine<P>> for Affine<P>where P: SWCurveConfig,
source§impl<P: SWCurveConfig> PartialEq<Affine<P>> for Projective<P>
impl<P: SWCurveConfig> PartialEq<Affine<P>> for Projective<P>
source§impl<P: SWCurveConfig> PartialEq<Projective<P>> for Affine<P>
impl<P: SWCurveConfig> PartialEq<Projective<P>> for Affine<P>
source§fn eq(&self, other: &Projective<P>) -> bool
fn eq(&self, other: &Projective<P>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<P: SWCurveConfig, T: Borrow<Self>> Sub<T> for Affine<P>
impl<P: SWCurveConfig, T: Borrow<Self>> Sub<T> for Affine<P>
§type Output = Projective<P>
type Output = Projective<P>
-
operator.source§fn sub(self, other: T) -> Projective<P>
fn sub(self, other: T) -> Projective<P>
-
operation. Read more