[][src]Struct curve25519_dalek::edwards::EdwardsPoint

pub struct EdwardsPoint {
    pub(crate) X: FieldElement51,
    pub(crate) Y: FieldElement51,
    pub(crate) Z: FieldElement51,
    pub(crate) T: FieldElement51,
}

An EdwardsPoint represents a point on the Edwards form of Curve25519.

Fields

X: FieldElement51Y: FieldElement51Z: FieldElement51T: FieldElement51

Methods

impl EdwardsPoint[src]

pub(crate) fn to_projective_niels(&self) -> ProjectiveNielsPoint[src]

Convert to a ProjectiveNielsPoint

pub(crate) fn to_projective(&self) -> ProjectivePoint[src]

Convert the representation of this point from extended coordinates to projective coordinates.

Free.

pub(crate) fn to_affine_niels(&self) -> AffineNielsPoint[src]

Dehomogenize to a AffineNielsPoint. Mainly for testing.

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

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

This function has one exceptional case; the identity point of the Edwards curve is sent to the 2-torsion point \((0,0)\) on the Montgomery curve.

Note that this is a one-way conversion, since the Montgomery model does not retain sign information.

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

Compress this point to CompressedEdwardsY format.

impl EdwardsPoint[src]

pub(crate) fn double(&self) -> EdwardsPoint[src]

Add this point to itself.

impl EdwardsPoint[src]

pub fn vartime_double_scalar_mul_basepoint(
    a: &Scalar,
    A: &EdwardsPoint,
    b: &Scalar
) -> EdwardsPoint
[src]

Compute \(aA + bB\) in variable time, where \(B\) is the Ed25519 basepoint.

impl EdwardsPoint[src]

pub fn mul_by_cofactor(&self) -> EdwardsPoint[src]

Multiply by the cofactor: return \([8]P\).

pub(crate) fn mul_by_pow_2(&self, k: u32) -> EdwardsPoint[src]

Compute \([2^k] P \) by successive doublings. Requires \( k > 0 \).

pub fn is_small_order(&self) -> bool[src]

Determine if this point is of small order.

Return

  • true if self is in the torsion subgroup \( \mathcal E[8] \);
  • false if self is not in the torsion subgroup \( \mathcal E[8] \).

Example

use curve25519_dalek::constants;

// Generator of the prime-order subgroup
let P = constants::ED25519_BASEPOINT_POINT;
// Generator of the torsion subgroup
let Q = constants::EIGHT_TORSION[1];

// P has large order
assert_eq!(P.is_small_order(), false);

// Q has small order
assert_eq!(Q.is_small_order(), true);

pub fn is_torsion_free(&self) -> bool[src]

Determine if this point is “torsion-free”, i.e., is contained in the prime-order subgroup.

Return

  • true if self has zero torsion component and is in the prime-order subgroup;
  • false if self has a nonzero torsion component and is not in the prime-order subgroup.

Example

use curve25519_dalek::constants;

// Generator of the prime-order subgroup
let P = constants::ED25519_BASEPOINT_POINT;
// Generator of the torsion subgroup
let Q = constants::EIGHT_TORSION[1];

// P is torsion-free
assert_eq!(P.is_torsion_free(), true);

// P + Q is not torsion-free
assert_eq!((P+Q).is_torsion_free(), false);

Trait Implementations

impl Identity for EdwardsPoint[src]

impl MultiscalarMul for EdwardsPoint[src]

type Point = EdwardsPoint

The type of point being multiplied, e.g., RistrettoPoint.

impl VartimeMultiscalarMul for EdwardsPoint[src]

type Point = EdwardsPoint

The type of point being multiplied, e.g., RistrettoPoint.

fn vartime_multiscalar_mul<I, J>(scalars: I, points: J) -> Self::Point where
    I: IntoIterator,
    I::Item: Borrow<Scalar>,
    J: IntoIterator,
    J::Item: Borrow<Self::Point>,
    Self::Point: Clone
[src]

Given an iterator of public scalars and an iterator of public points, compute $$ Q = c_1 P_1 + \cdots + c_n P_n, $$ using variable-time operations. Read more

impl ValidityCheck for EdwardsPoint[src]

impl Clone for EdwardsPoint[src]

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

Performs copy-assignment from source. Read more

impl Debug for EdwardsPoint[src]

impl PartialEq<EdwardsPoint> for EdwardsPoint[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl Eq for EdwardsPoint[src]

impl From<EdwardsPoint> for ExtendedPoint[src]

impl From<ExtendedPoint> for EdwardsPoint[src]

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

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

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

impl From<EdwardsPoint> for ExtendedPoint[src]

impl From<ExtendedPoint> for EdwardsPoint[src]

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

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

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

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

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

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

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

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

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

impl Copy for EdwardsPoint[src]

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

type Output = EdwardsPoint

The resulting type after applying the + operator.

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

type Output = EdwardsPoint

The resulting type after applying the + operator.

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

type Output = EdwardsPoint

The resulting type after applying the + operator.

impl Add<EdwardsPoint> for EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the + operator.

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

type Output = CompletedPoint

The resulting type after applying the + operator.

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

type Output = CompletedPoint

The resulting type after applying the + operator.

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

type Output = EdwardsPoint

The resulting type after applying the - operator.

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

type Output = EdwardsPoint

The resulting type after applying the - operator.

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

type Output = EdwardsPoint

The resulting type after applying the - operator.

impl Sub<EdwardsPoint> for EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the - operator.

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

type Output = CompletedPoint

The resulting type after applying the - operator.

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

type Output = CompletedPoint

The resulting type after applying the - operator.

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

type Output = EdwardsPoint

The resulting type after applying the * operator.

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

type Output = EdwardsPoint

The resulting type after applying the * operator.

impl Mul<Scalar> for EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the * operator.

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

type Output = EdwardsPoint

The resulting type after applying the * operator.

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

type Output = EdwardsPoint

The resulting type after applying the * operator.

impl Mul<EdwardsPoint> for Scalar[src]

type Output = EdwardsPoint

The resulting type after applying the * operator.

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 scalar * self.

For scalar multiplication of a basepoint, EdwardsBasepointTable is approximately 4x faster.

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

type Output = EdwardsPoint

The resulting type after applying the * operator.

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

Scalar multiplication: compute scalar * self.

For scalar multiplication of a basepoint, EdwardsBasepointTable is approximately 4x faster.

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

type Output = EdwardsPoint

The resulting type after applying the - operator.

impl Neg for EdwardsPoint[src]

type Output = EdwardsPoint

The resulting type after applying the - operator.

impl<'b> AddAssign<&'b EdwardsPoint> for EdwardsPoint[src]

impl AddAssign<EdwardsPoint> for EdwardsPoint[src]

impl<'b> SubAssign<&'b EdwardsPoint> for EdwardsPoint[src]

impl SubAssign<EdwardsPoint> for EdwardsPoint[src]

impl<'b> MulAssign<&'b Scalar> for EdwardsPoint[src]

impl MulAssign<Scalar> for EdwardsPoint[src]

impl<T> Sum<T> for EdwardsPoint where
    T: Borrow<EdwardsPoint>, 
[src]

impl Default for EdwardsPoint[src]

impl ConstantTimeEq for EdwardsPoint[src]

impl ConditionallySelectable for EdwardsPoint[src]

fn conditional_assign(&mut self, other: &Self, choice: Choice)[src]

Conditionally assign other to self, according to choice. Read more

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)[src]

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more

Auto Trait Implementations

impl Send for EdwardsPoint

impl Sync for EdwardsPoint

Blanket Implementations

impl<T> IsIdentity for T where
    T: ConstantTimeEq + Identity
[src]

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

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

type Owned = T

impl<T> FromCast for T

impl<T, U> Cast for T where
    U: FromCast<T>, 

impl<T, U> IntoBits for T where
    U: FromBits<T>, 

impl<T> FromBits for T

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

impl<T> InitializableFromZeroed for T where
    T: Default

impl<T> Same for T

type Output = T

Should always be Self

impl<T> ConditionallyNegatable for T where
    T: ConditionallySelectable,
    &'a T: Neg,
    <&'a T as Neg>::Output == T, 
[src]