Struct ark_test_curves::twisted_edwards::Affine
source · pub struct Affine<P>where
P: TECurveConfig,{
pub x: <P as CurveConfig>::BaseField,
pub y: <P as CurveConfig>::BaseField,
}
Expand description
Affine coordinates for a point on a twisted Edwards curve, over the
base field P::BaseField
.
Fields§
§x: <P as CurveConfig>::BaseField
X coordinate of the point represented as a field element
y: <P as CurveConfig>::BaseField
Y coordinate of the point represented as a field element
Implementations§
source§impl<P> Affine<P>where
P: TECurveConfig,
impl<P> Affine<P>where P: TECurveConfig,
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>
Construct a new group element without checking whether the coordinates specify a point in the subgroup.
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>
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 as CurveConfig>::BaseField,
greatest: bool
) -> Option<Affine<P>>
pub fn get_point_from_y_unchecked( y: <P as CurveConfig>::BaseField, greatest: bool ) -> Option<Affine<P>>
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 as CurveConfig>::BaseField
) -> Option<(<P as CurveConfig>::BaseField, <P as CurveConfig>::BaseField)>
pub fn get_xs_from_y_unchecked( y: <P as CurveConfig>::BaseField ) -> Option<(<P as CurveConfig>::BaseField, <P as CurveConfig>::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> Affine<P>where
P: TECurveConfig,
impl<P> Affine<P>where P: TECurveConfig,
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> Add<&'a Projective<P>> for Affine<P>where
P: TECurveConfig,
impl<'a, P> Add<&'a Projective<P>> for Affine<P>where P: TECurveConfig,
§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: TECurveConfig,
impl<P> Add<Projective<P>> for Affine<P>where P: TECurveConfig,
§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> AffineRepr for Affine<P>where
P: TECurveConfig,
impl<P> AffineRepr for Affine<P>where P: TECurveConfig,
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
§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<(&<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: TECurveConfig,
impl<P> CanonicalDeserialize for Affine<P>where P: TECurveConfig,
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: TECurveConfig,
impl<P> CanonicalSerialize for Affine<P>where P: TECurveConfig,
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> Clone for Affine<P>where
P: TECurveConfig,
impl<P> Clone for Affine<P>where P: TECurveConfig,
source§impl<P> Debug for Affine<P>where
P: TECurveConfig,
impl<P> Debug for Affine<P>where P: TECurveConfig,
source§impl<P> Default for Affine<P>where
P: TECurveConfig,
impl<P> Default for Affine<P>where P: TECurveConfig,
source§impl<P> Display for Affine<P>where
P: TECurveConfig,
impl<P> Display for Affine<P>where P: TECurveConfig,
source§impl<P> From<Affine<P>> for Projective<P>where
P: TECurveConfig,
impl<P> From<Affine<P>> for Projective<P>where P: TECurveConfig,
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: TECurveConfig,
impl<P> From<Projective<P>> for Affine<P>where P: TECurveConfig,
source§fn from(p: Projective<P>) -> Affine<P>
fn from(p: Projective<P>) -> Affine<P>
source§impl<P> Hash for Affine<P>where
P: TECurveConfig,
impl<P> Hash for Affine<P>where P: TECurveConfig,
source§impl<P, T> Mul<T> for Affine<P>where
P: TECurveConfig,
T: Borrow<<P as CurveConfig>::ScalarField>,
impl<P, T> Mul<T> for Affine<P>where P: TECurveConfig, T: Borrow<<P as CurveConfig>::ScalarField>,
source§impl<P> Neg for Affine<P>where
P: TECurveConfig,
impl<P> Neg for Affine<P>where P: TECurveConfig,
source§impl<P> PartialEq<Affine<P>> for Affine<P>where
P: TECurveConfig,
impl<P> PartialEq<Affine<P>> for Affine<P>where P: TECurveConfig,
source§impl<P> PartialEq<Affine<P>> for Projective<P>where
P: TECurveConfig,
impl<P> PartialEq<Affine<P>> for Projective<P>where P: TECurveConfig,
source§impl<P> PartialEq<Projective<P>> for Affine<P>where
P: TECurveConfig,
impl<P> PartialEq<Projective<P>> for Affine<P>where P: TECurveConfig,
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 ==
.