[−][src]Struct zerocaf::edwards::ProjectivePoint
A ProjectivePoint
represents a point on the Sonny Curve expressed
over the Twisted Edwards Projective Coordinates eg. (X:Y:Z).
For Z1≠0 the point (X1:Y1:Z1) represents the affine point (x1= X1/Z1, y1= Y1/Z1)
on EE,a,d.
Projective coordinates represent x
y
as (X, Y, Z
) satisfying the following equations:
x=X/Z
y=Y/Z
Expressing an elliptic curve in twisted Edwards form saves time in arithmetic, even when the same curve can be expressed in the Edwards form.
Fields
X: FieldElement
Y: FieldElement
Z: FieldElement
Methods
impl ProjectivePoint
[src][−]
pub fn new_from_y_coord(
y: &FieldElement,
sign: Choice
) -> Option<ProjectivePoint>
[src][−]
y: &FieldElement,
sign: Choice
) -> Option<ProjectivePoint>
This function tries to build a Point over the Sonny Curve from
a Y
coordinate and a Choice that determines the sign of the X
coordinate that the user wants to use.
The function gets X
by solving:
+-X = mod_sqrt((y^2 -1)/(dy^2 - a))
.
The sign of x
is choosen with a Choice
parameter.
For Choice(0) -> Negative result. For Choice(1) -> Positive result.
Then Z is always equal to 1
.
Returns
Some(ProjectivePoint)
if there exists a result for the mod_sqrt
and None
if the resulting x^2
isn't a QR modulo FIELD_L
.
pub fn new_random_point<T: Rng + CryptoRng>(rand: &mut T) -> ProjectivePoint
[src][−]
This function tries to build a Point over the Sonny Curve from
a random Y
coordinate and a random Choice that determines the
sign of the X
coordinate.
Trait Implementations
impl<'a, 'b> Add<&'b ProjectivePoint> for &'a ProjectivePoint
[src][+]
impl Add<ProjectivePoint> for ProjectivePoint
[src][+]
impl Clone for ProjectivePoint
[src][+]
impl ConstantTimeEq for ProjectivePoint
[src][+]
impl Copy for ProjectivePoint
[src]
impl Debug for ProjectivePoint
[src][+]
impl Default for ProjectivePoint
[src][+]
impl<'a> Double for &'a ProjectivePoint
[src][+]
impl Eq for ProjectivePoint
[src]
impl From<AffinePoint> for ProjectivePoint
[src][+]
impl From<EdwardsPoint> for ProjectivePoint
[src][+]
impl From<ProjectivePoint> for EdwardsPoint
[src][+]
impl From<ProjectivePoint> for AffinePoint
[src][+]
impl Identity for ProjectivePoint
[src][+]
impl<'a, 'b> Mul<&'a Scalar> for &'b ProjectivePoint
[src][+]
impl Mul<Scalar> for ProjectivePoint
[src][+]
impl<'a> Neg for &'a ProjectivePoint
[src][+]
impl Neg for ProjectivePoint
[src][+]
impl PartialEq<ProjectivePoint> for ProjectivePoint
[src][+]
impl<'a, 'b> Sub<&'b ProjectivePoint> for &'a ProjectivePoint
[src][+]
impl Sub<ProjectivePoint> for ProjectivePoint
[src][+]
impl ValidityCheck for ProjectivePoint
[src][+]
Auto Trait Implementations
impl RefUnwindSafe for ProjectivePoint
impl Send for ProjectivePoint
impl Sync for ProjectivePoint
impl Unpin for ProjectivePoint
impl UnwindSafe for ProjectivePoint
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
[+]
T: InitializableFromZeroed + ?Sized,
impl<T> From<T> for T
[src][+]
impl<T> InitializableFromZeroed for T where
T: Default,
[+]
T: Default,
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[+]
V: MultiLane<T>,