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,
impl<P> Affine<P>where
P: SWCurveConfig,
Sourcepub fn new(
x: <P as CurveConfig>::BaseField,
y: <P as CurveConfig>::BaseField,
) -> Affine<P>
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.
Sourcepub const fn new_unchecked(
x: <P as CurveConfig>::BaseField,
y: <P as CurveConfig>::BaseField,
) -> Affine<P>
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.
pub const fn identity() -> Affine<P>
Sourcepub fn get_point_from_x_unchecked(
x: <P as CurveConfig>::BaseField,
greatest: bool,
) -> Option<Affine<P>>
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.
Sourcepub fn get_ys_from_x_unchecked(
x: <P as CurveConfig>::BaseField,
) -> Option<(<P as CurveConfig>::BaseField, <P as CurveConfig>::BaseField)>
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.
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> Affine<P>where
P: SWCurveConfig,
impl<P> Affine<P>where
P: SWCurveConfig,
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> Add<&'a Projective<P>> for Affine<P>where
P: SWCurveConfig,
impl<'a, P> Add<&'a Projective<P>> for Affine<P>where
P: SWCurveConfig,
Source§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> Add<Projective<P>> for Affine<P>where
P: SWCurveConfig,
impl<P> Add<Projective<P>> for Affine<P>where
P: SWCurveConfig,
Source§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, T> Add<T> for Affine<P>
impl<P, T> Add<T> for Affine<P>
Source§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> AffineRepr for Affine<P>where
P: SWCurveConfig,
impl<P> AffineRepr for Affine<P>where
P: SWCurveConfig,
Source§fn mul_by_cofactor_to_group(&self) -> <Affine<P> as AffineRepr>::Group
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>
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.
type Config = P
Source§type BaseField = <P as CurveConfig>::BaseField
type BaseField = <P as CurveConfig>::BaseField
type ScalarField = <P as CurveConfig>::ScalarField
Source§type Group = Projective<P>
type Group = Projective<P>
Source§fn xy(
&self,
) -> Option<(<Affine<P> as AffineRepr>::BaseField, <Affine<P> as AffineRepr>::BaseField)>
fn xy( &self, ) -> Option<(<Affine<P> as AffineRepr>::BaseField, <Affine<P> as AffineRepr>::BaseField)>
Source§fn from_random_bytes(bytes: &[u8]) -> Option<Affine<P>>
fn from_random_bytes(bytes: &[u8]) -> Option<Affine<P>>
Source§fn mul_bigint(&self, by: impl AsRef<[u64]>) -> <Affine<P> as AffineRepr>::Group
fn mul_bigint(&self, by: impl AsRef<[u64]>) -> <Affine<P> as AffineRepr>::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> CanonicalDeserialize for Affine<P>where
P: SWCurveConfig,
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,
fn deserialize_with_mode<R>(
reader: R,
compress: Compress,
validate: Validate,
) -> Result<Affine<P>, SerializationError>where
R: Read,
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> CanonicalSerialize for Affine<P>where
P: SWCurveConfig,
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,
fn serialize_with_mode<W>(
&self,
writer: W,
compress: Compress,
) -> Result<(), SerializationError>where
W: Write,
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> Debug for Affine<P>where
P: SWCurveConfig,
impl<P> Debug for Affine<P>where
P: SWCurveConfig,
Source§impl<P> Default for Affine<P>where
P: SWCurveConfig,
impl<P> Default for Affine<P>where
P: SWCurveConfig,
Source§impl<P> Display for Affine<P>where
P: SWCurveConfig,
impl<P> Display for Affine<P>where
P: SWCurveConfig,
Source§impl<'a, P> From<&'a Affine<<P as BW6Config>::G1Config>> for G1Prepared<P>where
P: BW6Config,
impl<'a, P> From<&'a Affine<<P as BW6Config>::G1Config>> for G1Prepared<P>where
P: BW6Config,
Source§impl<'a, P> From<&'a Affine<<P as BW6Config>::G2Config>> for G2Prepared<P>where
P: BW6Config,
impl<'a, P> From<&'a Affine<<P as BW6Config>::G2Config>> for G2Prepared<P>where
P: BW6Config,
Source§impl<'a, P> From<&'a Affine<<P as Bls12Config>::G1Config>> for G1Prepared<P>where
P: Bls12Config,
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>
fn from(other: &'a Affine<<P as Bls12Config>::G1Config>) -> G1Prepared<P>
Source§impl<'a, P> From<&'a Affine<<P as Bls12Config>::G2Config>> for G2Prepared<P>where
P: Bls12Config,
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>
fn from(other: &'a Affine<<P as Bls12Config>::G2Config>) -> G2Prepared<P>
Source§impl<'a, P> From<&'a Affine<<P as MNT4Config>::G1Config>> for G1Prepared<P>where
P: MNT4Config,
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>
fn from(g1: &'a Affine<<P as MNT4Config>::G1Config>) -> G1Prepared<P>
Source§impl<'a, P> From<&'a Affine<<P as MNT4Config>::G2Config>> for G2Prepared<P>where
P: MNT4Config,
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>
fn from(g2: &'a Affine<<P as MNT4Config>::G2Config>) -> G2Prepared<P>
Source§impl<'a, P> From<&'a Affine<<P as MNT6Config>::G1Config>> for G1Prepared<P>where
P: MNT6Config,
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>
fn from(g1: &'a Affine<<P as MNT6Config>::G1Config>) -> G1Prepared<P>
Source§impl<'a, P> From<&'a Affine<<P as MNT6Config>::G2Config>> for G2Prepared<P>where
P: MNT6Config,
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>
fn from(g2: &'a Affine<<P as MNT6Config>::G2Config>) -> G2Prepared<P>
Source§impl<P> From<Affine<<P as Bls12Config>::G1Config>> for G1Prepared<P>where
P: Bls12Config,
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>
fn from(other: Affine<<P as Bls12Config>::G1Config>) -> G1Prepared<P>
Source§impl<P> From<Affine<<P as Bls12Config>::G2Config>> for G2Prepared<P>where
P: Bls12Config,
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>
fn from(q: Affine<<P as Bls12Config>::G2Config>) -> G2Prepared<P>
Source§impl<P> From<Affine<<P as MNT4Config>::G1Config>> for G1Prepared<P>where
P: MNT4Config,
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>
fn from(g1: Affine<<P as MNT4Config>::G1Config>) -> G1Prepared<P>
Source§impl<P> From<Affine<<P as MNT4Config>::G2Config>> for G2Prepared<P>where
P: MNT4Config,
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>
fn from(g: Affine<<P as MNT4Config>::G2Config>) -> G2Prepared<P>
Source§impl<P> From<Affine<<P as MNT6Config>::G1Config>> for G1Prepared<P>where
P: MNT6Config,
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>
fn from(g1: Affine<<P as MNT6Config>::G1Config>) -> G1Prepared<P>
Source§impl<P> From<Affine<<P as MNT6Config>::G2Config>> for G2Prepared<P>where
P: MNT6Config,
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>
fn from(g: Affine<<P as MNT6Config>::G2Config>) -> G2Prepared<P>
Source§impl<P> From<Affine<P>> for Projective<P>where
P: SWCurveConfig,
impl<P> From<Affine<P>> for Projective<P>where
P: SWCurveConfig,
Source§fn from(p: Affine<P>) -> Projective<P>
fn from(p: Affine<P>) -> Projective<P>
Source§impl<P> From<Projective<P>> for Affine<P>where
P: SWCurveConfig,
impl<P> From<Projective<P>> for Affine<P>where
P: SWCurveConfig,
Source§fn from(p: Projective<P>) -> Affine<P>
fn from(p: Projective<P>) -> Affine<P>
Source§impl<P> Neg for Affine<P>where
P: SWCurveConfig,
impl<P> Neg for Affine<P>where
P: SWCurveConfig,
Source§impl<P> PartialEq<Affine<P>> for Projective<P>where
P: SWCurveConfig,
impl<P> PartialEq<Affine<P>> for Projective<P>where
P: SWCurveConfig,
Source§impl<P> PartialEq<Projective<P>> for Affine<P>where
P: SWCurveConfig,
impl<P> PartialEq<Projective<P>> for Affine<P>where
P: SWCurveConfig,
Source§impl<'a, P> Sub<&'a Projective<P>> for Affine<P>where
P: SWCurveConfig,
impl<'a, P> Sub<&'a Projective<P>> for Affine<P>where
P: SWCurveConfig,
Source§type Output = Projective<P>
type Output = Projective<P>
-
operator.Source§fn sub(self, other: &'a Projective<P>) -> Projective<P>
fn sub(self, other: &'a Projective<P>) -> Projective<P>
-
operation. Read moreSource§impl<P> Sub<Projective<P>> for Affine<P>where
P: SWCurveConfig,
impl<P> Sub<Projective<P>> for Affine<P>where
P: SWCurveConfig,
Source§type Output = Projective<P>
type Output = Projective<P>
-
operator.Source§fn sub(self, other: Projective<P>) -> Projective<P>
fn sub(self, other: Projective<P>) -> Projective<P>
-
operation. Read moreSource§impl<P, T> Sub<T> for Affine<P>
impl<P, T> Sub<T> for Affine<P>
Source§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 moreSource§impl<M, ConstraintF> ToConstraintField<ConstraintF> for Affine<M>where
M: SWCurveConfig,
ConstraintF: Field,
<M as CurveConfig>::BaseField: ToConstraintField<ConstraintF>,
impl<M, ConstraintF> ToConstraintField<ConstraintF> for Affine<M>where
M: SWCurveConfig,
ConstraintF: Field,
<M as CurveConfig>::BaseField: ToConstraintField<ConstraintF>,
fn to_field_elements(&self) -> Option<Vec<ConstraintF>>
Source§impl<P> Valid for Affine<P>where
P: SWCurveConfig,
impl<P> Valid for Affine<P>where
P: SWCurveConfig,
fn check(&self) -> Result<(), SerializationError>
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,
impl<P> Zeroize for Affine<P>where
P: SWCurveConfig,
impl<P> Copy for Affine<P>
impl<P> Eq for Affine<P>
Auto Trait Implementations§
impl<P> Freeze for Affine<P>
impl<P> RefUnwindSafe for Affine<P>
impl<P> Send for Affine<P>
impl<P> Sync for Affine<P>
impl<P> Unpin for Affine<P>
impl<P> UnwindSafe for Affine<P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
impl<T> CanonicalSerializeHashExt for Twhere
T: CanonicalSerialize,
fn hash<H>(&self) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>where
H: Digest,
fn hash_uncompressed<H>(
&self,
) -> GenericArray<u8, <H as OutputSizeUser>::OutputSize>where
H: Digest,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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