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
sourceimpl<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.
sourceimpl<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
sourceimpl<'a, P: TECurveConfig> Add<&'a Projective<P>> for Affine<P>
impl<'a, P: TECurveConfig> Add<&'a Projective<P>> for Affine<P>
type Output = Projective<P>
type Output = Projective<P>
+
operator.sourcefn add(self, other: &'a Projective<P>) -> Projective<P>
fn add(self, other: &'a Projective<P>) -> Projective<P>
+
operation. Read moresourceimpl<P: TECurveConfig> Add<Projective<P>> for Affine<P>
impl<P: TECurveConfig> Add<Projective<P>> for Affine<P>
type Output = Projective<P>
type Output = Projective<P>
+
operator.sourcefn add(self, other: Projective<P>) -> Projective<P>
fn add(self, other: Projective<P>) -> Projective<P>
+
operation. Read moresourceimpl<P: TECurveConfig, T: Borrow<Self>> Add<T> for Affine<P>
impl<P: TECurveConfig, T: Borrow<Self>> Add<T> for Affine<P>
sourceimpl<P: TECurveConfig> AffineRepr for Affine<P>
impl<P: TECurveConfig> AffineRepr for Affine<P>
sourcefn 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.
sourcefn 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>
sourcefn xy(&self) -> Option<(&Self::BaseField, &Self::BaseField)>
fn xy(&self) -> Option<(&Self::BaseField, &Self::BaseField)>
sourcefn from_random_bytes(bytes: &[u8]) -> Option<Self>
fn from_random_bytes(bytes: &[u8]) -> Option<Self>
sourcefn mul_bigint(&self, by: impl AsRef<[u64]>) -> Self::Group
fn mul_bigint(&self, by: impl AsRef<[u64]>) -> Self::Group
sourcefn into_group(self) -> Self::Group
fn into_group(self) -> Self::Group
sourcefn mul_by_cofactor(&self) -> Self
fn mul_by_cofactor(&self) -> Self
sourcefn mul_by_cofactor_inv(&self) -> Self
fn mul_by_cofactor_inv(&self) -> Self
Self::ScalarField
. Read more