[][src]Struct zerocaf::edwards::EdwardsPoint

pub struct EdwardsPoint {
    pub X: FieldElement,
    pub Y: FieldElement,
    pub Z: FieldElement,
    pub T: FieldElement,
}

An EdwardsPoint represents a point on the Doppio Curve expressed over the Twisted Edwards Extended Coordinates eg. (X, Y, Z, T).

Extended coordinates represent x y as(X Y Z T) satisfying the following equations: x=X/Z y=Y/Z x*y=T/Z

Fields

X: FieldElementY: FieldElementZ: FieldElementT: FieldElement

Methods

impl EdwardsPoint[src]

pub fn to_montgomery(&self) -> MontgomeryPoint[src]

Convert this EdwardsPoint on the Edwards model to the corresponding MontgomeryPoint on the Montgomery model.

pub fn compress(&self) -> CompressedEdwardsY[src]

Compress this point to CompressedEdwardsY format.

pub fn new_from_y_coord(y: &FieldElement, sign: Choice) -> Option<EdwardsPoint>[src]

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(EdwardsPoint) 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() -> EdwardsPoint[src]

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

impl Identity for EdwardsPoint[src]

fn identity() -> EdwardsPoint[src]

Returns the Edwards Point identity value = (0, 1, 1, 0).

impl<'a> Double for &'a EdwardsPoint[src]

type Output = EdwardsPoint

fn double(self) -> EdwardsPoint[src]

Performs the point doubling operation ie. 2*P over the Twisted Edwards Extended Coordinates.

This implementation is specific for curves with a = -1 as Doppio is. Source: 2008 Hisil–Wong–Carter–Dawson, http://eprint.iacr.org/2008/522, Section 3.1. Cost: 4M+ 4S+ 1D

impl Clone for EdwardsPoint[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Default for EdwardsPoint[src]

fn default() -> EdwardsPoint[src]

Returns the default EdwardsPoint Extended Coordinates: (0, 1, 1, 0).

impl<'a> From<&'a ProjectivePoint> for EdwardsPoint[src]

fn from(point: &'a ProjectivePoint) -> EdwardsPoint[src]

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.

impl<'a> From<&'a AffinePoint> for EdwardsPoint[src]

fn from(point: &'a AffinePoint) -> EdwardsPoint[src]

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).

After this is done, we move from Projective to Extended by setting the new coordinate T = X * Y.

impl<'a> From<&'a EdwardsPoint> for ProjectivePoint[src]

fn from(point: &'a EdwardsPoint) -> ProjectivePoint[src]

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.

impl<'a> From<&'a EdwardsPoint> for AffinePoint[src]

fn from(point: &'a EdwardsPoint) -> AffinePoint[src]

Given (X:Y:Z:T) in εε, passing to affine can be performed in 3M+ 1I by computing:

First, move to Projective Coordinates by removing T.

Then, 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.

impl PartialEq<EdwardsPoint> for EdwardsPoint[src]

#[must_use] fn ne(&self, other: &Rhs) -> bool1.0.0[src]

This method tests for !=.

impl Copy for EdwardsPoint[src]

impl Eq for EdwardsPoint[src]

impl Debug for EdwardsPoint[src]

impl<'a, 'b> Add<&'b EdwardsPoint> for &'a EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the + operator.

fn add(self, other: &'b EdwardsPoint) -> EdwardsPoint[src]

Add two EdwardsPoints and give the resulting EdwardsPoint. This implementation is specific for curves with a = -1 as Doppio is.

[Source: 2008 Hisil–Wong–Carter–Dawson], (http://eprint.iacr.org/2008/522), Section 3.1.

impl<'a, 'b> Sub<&'b EdwardsPoint> for &'a EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the - operator.

fn sub(self, other: &'b EdwardsPoint) -> EdwardsPoint[src]

Substract two EdwardsPoints and give the resulting EdwardsPoint This implementation is specific for curves with a = -1 as Doppio is. Source: 2008 Hisil–Wong–Carter–Dawson, http://eprint.iacr.org/2008/522, Section 3.1.

The only thing we do is negate the second EdwardsPoint and add it following the same addition algorithm.

impl<'a, 'b> Mul<&'b Scalar> for &'a EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the * operator.

fn mul(self, scalar: &'b Scalar) -> EdwardsPoint[src]

Scalar multiplication: compute self * Scalar. 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.

impl Mul<Scalar> for EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the * operator.

fn mul(self, scalar: Scalar) -> EdwardsPoint[src]

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.

impl<'a> Neg for &'a EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the - operator.

fn neg(self) -> EdwardsPoint[src]

Negates an EdwardsPoint 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).

impl Neg for EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the - operator.

fn neg(self) -> EdwardsPoint[src]

Negates an EdwardsPoint giving it as a result

impl ConstantTimeEq for EdwardsPoint[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Clear for T where
    T: InitializableFromZeroed + ?Sized

impl<T> InitializableFromZeroed for T where
    T: Default

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,