pub struct Affine<P: TECurveConfig> {
pub x: P::BaseField,
pub y: P::BaseField,
}
Expand description
Affine coordinates for a point on a twisted Edwards curve, over the
base field P::BaseField
.
Fields§
§x: P::BaseField
X coordinate of the point represented as a field element
y: P::BaseField
Y coordinate of the point represented as a field element
Implementations§
Source§impl<P: TECurveConfig> Affine<P>
impl<P: TECurveConfig> Affine<P>
Sourcepub const fn new_unchecked(x: P::BaseField, y: P::BaseField) -> Self
pub const fn new_unchecked(x: P::BaseField, y: P::BaseField) -> Self
Construct a new group element without checking whether the coordinates specify a point in the subgroup.
Sourcepub fn new(x: P::BaseField, y: P::BaseField) -> Self
pub fn new(x: P::BaseField, y: P::BaseField) -> Self
Construct a new group element in a way while enforcing that points are in the prime-order subgroup.
Sourcepub fn get_point_from_y_unchecked(
y: P::BaseField,
greatest: bool,
) -> Option<Self>
pub fn get_point_from_y_unchecked( y: P::BaseField, greatest: bool, ) -> Option<Self>
Attempts to construct an affine point given an 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 x-coordinate be selected.
a * X^2 + Y^2 = 1 + d * X^2 * Y^2 a * X^2 - d * X^2 * Y^2 = 1 - Y^2 X^2 * (a - d * Y^2) = 1 - Y^2 X^2 = (1 - Y^2) / (a - d * Y^2)
Sourcepub fn get_xs_from_y_unchecked(
y: P::BaseField,
) -> Option<(P::BaseField, P::BaseField)>
pub fn get_xs_from_y_unchecked( y: P::BaseField, ) -> Option<(P::BaseField, P::BaseField)>
Attempts to recover the x-coordinate given an y-coordinate. The resulting point is not guaranteed to be in the prime order subgroup.
If and only if greatest
is set will the lexicographically
largest x-coordinate be selected.
a * X^2 + Y^2 = 1 + d * X^2 * Y^2 a * X^2 - d * X^2 * Y^2 = 1 - Y^2 X^2 * (a - d * Y^2) = 1 - Y^2 X^2 = (1 - Y^2) / (a - d * Y^2)
Sourcepub fn is_on_curve(&self) -> bool
pub fn is_on_curve(&self) -> bool
Checks that the current point is on the elliptic curve.
Source§impl<P: TECurveConfig> Affine<P>
impl<P: TECurveConfig> 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 equaling that of
P::ScalarField
given it is on the curve.
Trait Implementations§
Source§impl<'a, P: TECurveConfig> Add<&'a Projective<P>> for Affine<P>
impl<'a, P: TECurveConfig> Add<&'a Projective<P>> for Affine<P>
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: TECurveConfig> Add<Projective<P>> for Affine<P>
impl<P: TECurveConfig> Add<Projective<P>> for Affine<P>
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: TECurveConfig> AffineRepr for Affine<P>
impl<P: TECurveConfig> 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
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<(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: TECurveConfig> CanonicalDeserialize for Affine<P>
impl<P: TECurveConfig> 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: TECurveConfig> CanonicalSerialize for Affine<P>
impl<P: TECurveConfig> 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: TECurveConfig> Clone for Affine<P>
impl<P: TECurveConfig> Clone for Affine<P>
Source§impl<P: TECurveConfig> Debug for Affine<P>
impl<P: TECurveConfig> Debug for Affine<P>
Source§impl<P: TECurveConfig> Default for Affine<P>
impl<P: TECurveConfig> Default for Affine<P>
Source§impl<P: TECurveConfig> Display for Affine<P>
impl<P: TECurveConfig> Display for Affine<P>
Source§impl<P: TECurveConfig> Distribution<Affine<P>> for Standard
impl<P: TECurveConfig> Distribution<Affine<P>> for Standard
Source§impl<P: TECurveConfig> From<Affine<P>> for Projective<P>
impl<P: TECurveConfig> From<Affine<P>> for Projective<P>
Source§fn from(p: Affine<P>) -> Projective<P>
fn from(p: Affine<P>) -> Projective<P>
Source§impl<P: TECurveConfig> From<Projective<P>> for Affine<P>
impl<P: TECurveConfig> From<Projective<P>> for Affine<P>
Source§fn from(p: Projective<P>) -> Affine<P>
fn from(p: Projective<P>) -> Affine<P>
Source§impl<P: TECurveConfig> Hash for Affine<P>
impl<P: TECurveConfig> Hash for Affine<P>
Source§impl<P: TECurveConfig, T: Borrow<P::ScalarField>> Mul<T> for Affine<P>
impl<P: TECurveConfig, T: Borrow<P::ScalarField>> Mul<T> for Affine<P>
Source§impl<P: TECurveConfig> Neg for Affine<P>
impl<P: TECurveConfig> Neg for Affine<P>
Source§impl<P: TECurveConfig> PartialEq<Affine<P>> for Projective<P>
impl<P: TECurveConfig> PartialEq<Affine<P>> for Projective<P>
Source§impl<P: TECurveConfig> PartialEq<Projective<P>> for Affine<P>
impl<P: TECurveConfig> PartialEq<Projective<P>> for Affine<P>
Source§impl<P: TECurveConfig> PartialEq for Affine<P>
impl<P: TECurveConfig> PartialEq for Affine<P>
Source§impl<'a, P: TECurveConfig> Sub<&'a Projective<P>> for Affine<P>
impl<'a, P: TECurveConfig> Sub<&'a Projective<P>> for Affine<P>
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: TECurveConfig> Sub<Projective<P>> for Affine<P>
impl<P: TECurveConfig> Sub<Projective<P>> for Affine<P>
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<M: TECurveConfig, ConstraintF: Field> ToConstraintField<ConstraintF> for Affine<M>where
M::BaseField: ToConstraintField<ConstraintF>,
impl<M: TECurveConfig, ConstraintF: Field> ToConstraintField<ConstraintF> for Affine<M>where
M::BaseField: ToConstraintField<ConstraintF>,
fn to_field_elements(&self) -> Option<Vec<ConstraintF>>
Source§impl<P: TECurveConfig> Valid for Affine<P>
impl<P: TECurveConfig> Valid for Affine<P>
fn check(&self) -> Result<(), SerializationError>
fn batch_check<'a>(
batch: impl Iterator<Item = &'a Self> + Send,
) -> Result<(), SerializationError>where
Self: 'a,
Source§impl<P: TECurveConfig> Zeroize for Affine<P>
impl<P: TECurveConfig> Zeroize for Affine<P>
impl<P: TECurveConfig> Copy for Affine<P>
impl<P: TECurveConfig> 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