[−][src]Struct zerocaf::edwards::EdwardsPoint
An EdwardsPoint
represents a point on the Sonny Curve which is expressed
in the Twisted Edwards Extended Coordinates format, 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: FieldElement
Y: FieldElement
Z: FieldElement
T: 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 coset4(&self) -> [EdwardsPoint; 4]
[src]
Prints the 4Coset where the input EdwardsPoint
lives in.
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 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(EdwardsPoint)
if there exists a result for themod_sqrt
.None
if the resultingx^2
isn't a QR moduloFIELD_L
.
pub fn new_random_point<T: Rng + CryptoRng>(rand: &mut T) -> EdwardsPoint
[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 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 Sonny is.
[Source: 2008 Hisil–Wong–Carter–Dawson], (http://eprint.iacr.org/2008/522), Section 3.1.
impl Add<EdwardsPoint> for EdwardsPoint
[src]
type Output = EdwardsPoint
The resulting type after applying the +
operator.
fn add(self, other: EdwardsPoint) -> EdwardsPoint
[src]
Add two EdwardsPoints and give the resulting EdwardsPoint
.
This implementation is specific for curves with a = -1
as Sonny is.
[Source: 2008 Hisil–Wong–Carter–Dawson], (http://eprint.iacr.org/2008/522), Section 3.1.
impl Clone for EdwardsPoint
[src]
fn clone(&self) -> EdwardsPoint
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl ConstantTimeEq for EdwardsPoint
[src]
fn ct_eq(&self, other: &EdwardsPoint) -> Choice
[src]
impl Copy for EdwardsPoint
[src]
impl Debug for EdwardsPoint
[src]
impl Default for EdwardsPoint
[src]
fn default() -> EdwardsPoint
[src]
Returns the default EdwardsPoint Extended Coordinates: (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 Sonny is.
Source: 2008 Hisil–Wong–Carter–Dawson,
http://eprint.iacr.org/2008/522, Section 3.1.
Cost: 4M+ 4S+ 1D
impl Eq for EdwardsPoint
[src]
impl From<AffinePoint> for EdwardsPoint
[src]
fn from(point: 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 From<EdwardsPoint> for ProjectivePoint
[src]
fn from(point: 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 From<EdwardsPoint> for AffinePoint
[src]
fn from(point: 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 From<ProjectivePoint> for EdwardsPoint
[src]
fn from(point: 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 Identity for EdwardsPoint
[src]
fn identity() -> EdwardsPoint
[src]
Returns the Edwards Point identity value = (0, 1, 1, 0)
.
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's negated value
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 PartialEq<EdwardsPoint> for EdwardsPoint
[src]
fn eq(&self, other: &EdwardsPoint) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
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 Sonny 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 Sub<EdwardsPoint> for EdwardsPoint
[src]
type Output = EdwardsPoint
The resulting type after applying the -
operator.
fn sub(self, other: EdwardsPoint) -> EdwardsPoint
[src]
Substract two EdwardsPoints and give the resulting EdwardsPoint
This implementation is specific for curves with a = -1
as Sonny 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 ValidityCheck for EdwardsPoint
[src]
Auto Trait Implementations
impl RefUnwindSafe for EdwardsPoint
impl Send for EdwardsPoint
impl Sync for EdwardsPoint
impl Unpin for EdwardsPoint
impl UnwindSafe for EdwardsPoint
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Clear for T where
T: InitializableFromZeroed + ?Sized,
T: InitializableFromZeroed + ?Sized,
fn clear(&mut self)
impl<T> From<T> for T
[src]
impl<T> InitializableFromZeroed for T where
T: Default,
T: Default,
unsafe fn initialize(place: *mut T)
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,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,