pub struct ProjectivePoint {
pub X: FieldElement,
pub Y: FieldElement,
pub Z: FieldElement,
}Expand description
A ProjectivePoint represents a point on the Doppio 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: FieldElementImplementations§
Source§impl ProjectivePoint
impl ProjectivePoint
Sourcepub fn new_from_y_coord(
y: &FieldElement,
sign: Choice,
) -> Option<ProjectivePoint>
pub fn new_from_y_coord( y: &FieldElement, sign: Choice, ) -> Option<ProjectivePoint>
This function tries to build a Point over the Doppio Curve from
a Y coordinate and a Choice that determines the Sign o 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.
Sourcepub fn new_random_point() -> ProjectivePoint
pub fn new_random_point() -> ProjectivePoint
This function tries to build a Point over the Doppio Curve from
a random Y coordinate and a random Choice that determines the
Sign o the X coordinate.
Trait Implementations§
Source§impl<'a, 'b> Add<&'b ProjectivePoint> for &'a ProjectivePoint
impl<'a, 'b> Add<&'b ProjectivePoint> for &'a ProjectivePoint
Source§fn add(self, other: &'b ProjectivePoint) -> ProjectivePoint
fn add(self, other: &'b ProjectivePoint) -> ProjectivePoint
Add two ProjectivePoints and give the resulting ProjectivePoint.
This implementation is specific for curves with a = -1 as Doppio is.
Bernstein D.J., Birkner P., Joye M., Lange T., Peters C. (2008) Twisted Edwards Curves. In: Vaudenay S. (eds) Progress in Cryptology – AFRICACRYPT 2008. AFRICACRYPT 2008. Lecture Notes in Computer Science, vol 5023. Springer, Berlin, Heidelberg. See: https://eprint.iacr.org/2008/013.pdf - Section 6.
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
+ operator.Source§impl Add for ProjectivePoint
impl Add for ProjectivePoint
Source§fn add(self, other: ProjectivePoint) -> ProjectivePoint
fn add(self, other: ProjectivePoint) -> ProjectivePoint
Add two ProjectivePoints and give the resulting ProjectivePoint.
This implementation is specific for curves with a = -1 as Doppio is.
Bernstein D.J., Birkner P., Joye M., Lange T., Peters C. (2008) Twisted Edwards Curves. In: Vaudenay S. (eds) Progress in Cryptology – AFRICACRYPT 2008. AFRICACRYPT 2008. Lecture Notes in Computer Science, vol 5023. Springer, Berlin, Heidelberg. See: https://eprint.iacr.org/2008/013.pdf - Section 6.
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
+ operator.Source§impl Clone for ProjectivePoint
impl Clone for ProjectivePoint
Source§fn clone(&self) -> ProjectivePoint
fn clone(&self) -> ProjectivePoint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ConstantTimeEq for ProjectivePoint
impl ConstantTimeEq for ProjectivePoint
Source§impl Debug for ProjectivePoint
impl Debug for ProjectivePoint
Source§impl Default for ProjectivePoint
impl Default for ProjectivePoint
Source§fn default() -> ProjectivePoint
fn default() -> ProjectivePoint
Returns the default ProjectivePoint Extended Coordinates: (0, 1, 1).
Source§impl<'a> Double for &'a ProjectivePoint
impl<'a> Double for &'a ProjectivePoint
Source§fn double(self) -> ProjectivePoint
fn double(self) -> ProjectivePoint
Double the given point following:
This implementation is specific for curves with a = -1 as Doppio is.
/// Bernstein D.J., Birkner P., Joye M., Lange T., Peters C. (2008) Twisted Edwards Curves. In: Vaudenay S. (eds) Progress in Cryptology – AFRICACRYPT 2008. AFRICACRYPT 2008. Lecture Notes in Computer Science, vol 5023. Springer, Berlin, Heidelberg. See: https://eprint.iacr.org/2008/013.pdf - Section 6.
Cost: 3M+ 4S+ +7a + 1D.
type Output = ProjectivePoint
Source§impl<'a> From<&'a AffinePoint> for ProjectivePoint
impl<'a> From<&'a AffinePoint> for ProjectivePoint
Source§fn from(point: &'a AffinePoint) -> ProjectivePoint
fn from(point: &'a AffinePoint) -> ProjectivePoint
The key idea of projective coordinates is that instead of performing every division immediately, we defer the divisions by multiplying them into a denominator.
In affine form, each elliptic curve point has 2 coordinates, like (x,y). In the new projective form, each point will have 3 coordinates, like (X,Y,Z), with the restriction that Z is never zero.
The forward mapping is given by (x,y)→(xz,yz,z), for any non-zero z (usually chosen to be 1 for convenience).
Source§impl<'a> From<&'a EdwardsPoint> for ProjectivePoint
impl<'a> From<&'a EdwardsPoint> for ProjectivePoint
Source§fn from(point: &'a EdwardsPoint) -> ProjectivePoint
fn from(point: &'a EdwardsPoint) -> ProjectivePoint
Given (X:Y:T:Z) in εε, passing to ε is cost-free by
simply ignoring T.
Twisted Edwards Curves Revisited - Huseyin Hisil, Kenneth Koon-Ho Wong, Gary Carter, and Ed Dawson, Section 3.
Source§impl<'a> From<&'a ProjectivePoint> for AffinePoint
impl<'a> From<&'a ProjectivePoint> for AffinePoint
Source§fn from(point: &'a ProjectivePoint) -> AffinePoint
fn from(point: &'a ProjectivePoint) -> AffinePoint
Reduce the point from Projective to Affine coordinates computing: (XZinv, YZinv, Z*Zinv).
And once Z coord = 1 we can simply remove it.
Twisted Edwards Curves Revisited - Huseyin Hisil, Kenneth Koon-Ho Wong, Gary Carter, and Ed Dawson.
Source§impl<'a> From<&'a ProjectivePoint> for EdwardsPoint
impl<'a> From<&'a ProjectivePoint> for EdwardsPoint
Source§fn from(point: &'a ProjectivePoint) -> EdwardsPoint
fn from(point: &'a ProjectivePoint) -> EdwardsPoint
Given (X:Y:Z) in ε passing to εε can beperformed in 3M+ 1S by computing (XZ, YZ, X*Y, Z^2).
Twisted Edwards Curves Revisited - Huseyin Hisil, Kenneth Koon-Ho Wong, Gary Carter, and Ed Dawson, Section 3.
Source§impl Identity for ProjectivePoint
impl Identity for ProjectivePoint
Source§fn identity() -> ProjectivePoint
fn identity() -> ProjectivePoint
Returns the Edwards Point identity value = (0, 1, 1).
Source§impl<'a, 'b> Mul<&'a Scalar> for &'b ProjectivePoint
impl<'a, 'b> Mul<&'a Scalar> for &'b ProjectivePoint
Source§fn mul(self, scalar: &'a Scalar) -> ProjectivePoint
fn mul(self, scalar: &'a Scalar) -> ProjectivePoint
Scalar multiplication: compute Scalar * self.
This implementation uses the algorithm:
add_and_doubling which is the standard one for
this operations and also adds less constraints on
R1CS.
Hankerson, Darrel; Vanstone, Scott; Menezes, Alfred (2004). Guide to Elliptic Curve Cryptography. Springer Professional Computing. New York: Springer-Verlag.
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
* operator.Source§impl Mul<Scalar> for ProjectivePoint
impl Mul<Scalar> for ProjectivePoint
Source§fn mul(self, scalar: Scalar) -> ProjectivePoint
fn mul(self, scalar: Scalar) -> ProjectivePoint
Scalar multiplication: compute Scalar * self.
This implementation uses the algorithm:
add_and_doubling which is the standard one for
this operations and also adds less constraints on
R1CS.
Hankerson, Darrel; Vanstone, Scott; Menezes, Alfred (2004). Guide to Elliptic Curve Cryptography. Springer Professional Computing. New York: Springer-Verlag.
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
* operator.Source§impl<'a> Neg for &'a ProjectivePoint
impl<'a> Neg for &'a ProjectivePoint
Source§fn neg(self) -> ProjectivePoint
fn neg(self) -> ProjectivePoint
Negates an ProjectivePoint giving it as a result.
Since the negative of a point is (-X:Y:Z:-T), it
gives as a result: (-X, Y, Z, -T).
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
- operator.Source§impl Neg for ProjectivePoint
impl Neg for ProjectivePoint
Source§fn neg(self) -> ProjectivePoint
fn neg(self) -> ProjectivePoint
Negates an ProjectivePoint giving it as a result
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
- operator.Source§impl PartialEq for ProjectivePoint
impl PartialEq for ProjectivePoint
Source§impl<'a, 'b> Sub<&'b ProjectivePoint> for &'a ProjectivePoint
impl<'a, 'b> Sub<&'b ProjectivePoint> for &'a ProjectivePoint
Source§fn sub(self, other: &'b ProjectivePoint) -> ProjectivePoint
fn sub(self, other: &'b ProjectivePoint) -> ProjectivePoint
Add two ProjectivePoints, negating the second one,
This implementation is specific for curves with a = -1 as Doppio is.
Bernstein D.J., Birkner P., Joye M., Lange T., Peters C. (2008) Twisted Edwards Curves. In: Vaudenay S. (eds) Progress in Cryptology – AFRICACRYPT 2008. AFRICACRYPT 2008. Lecture Notes in Computer Science, vol 5023. Springer, Berlin, Heidelberg. See: https://eprint.iacr.org/2008/013.pdf - Section 6.
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
- operator.Source§impl Sub for ProjectivePoint
impl Sub for ProjectivePoint
Source§fn sub(self, other: ProjectivePoint) -> ProjectivePoint
fn sub(self, other: ProjectivePoint) -> ProjectivePoint
Add two ProjectivePoints, negating the second one,
This implementation is specific for curves with a = -1 as Doppio is.
Bernstein D.J., Birkner P., Joye M., Lange T., Peters C. (2008) Twisted Edwards Curves. In: Vaudenay S. (eds) Progress in Cryptology – AFRICACRYPT 2008. AFRICACRYPT 2008. Lecture Notes in Computer Science, vol 5023. Springer, Berlin, Heidelberg. See: https://eprint.iacr.org/2008/013.pdf - Section 6.
Source§type Output = ProjectivePoint
type Output = ProjectivePoint
- operator.