pub struct EdwardsPoint { /* private fields */ }
Expand description

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

Implementations§

source§

impl EdwardsPoint

source

pub fn to_montgomery(&self) -> MontgomeryPoint

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.

source

pub fn compress(&self) -> CompressedEdwardsY

Compress this point to CompressedEdwardsY format.

source§

impl EdwardsPoint

source

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

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

source§

impl EdwardsPoint

source

pub fn mul_by_cofactor(&self) -> EdwardsPoint

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

source

pub fn is_small_order(&self) -> bool

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_ng::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);
source

pub fn is_torsion_free(&self) -> bool

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_ng::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§

source§

impl<'a, 'b> Add<&'b EdwardsPoint> for &'a EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the + operator.
source§

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

Performs the + operation. Read more
source§

impl<'b> Add<&'b EdwardsPoint> for EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the + operator.
source§

fn add(self, rhs: &'b EdwardsPoint) -> EdwardsPoint

Performs the + operation. Read more
source§

impl<'a> Add<EdwardsPoint> for &'a EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the + operator.
source§

fn add(self, rhs: EdwardsPoint) -> EdwardsPoint

Performs the + operation. Read more
source§

impl Add<EdwardsPoint> for EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the + operator.
source§

fn add(self, rhs: EdwardsPoint) -> EdwardsPoint

Performs the + operation. Read more
source§

impl<'b> AddAssign<&'b EdwardsPoint> for EdwardsPoint

source§

fn add_assign(&mut self, _rhs: &'b EdwardsPoint)

Performs the += operation. Read more
source§

impl AddAssign<EdwardsPoint> for EdwardsPoint

source§

fn add_assign(&mut self, rhs: EdwardsPoint)

Performs the += operation. Read more
source§

impl Clone for EdwardsPoint

source§

fn clone(&self) -> EdwardsPoint

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ConditionallySelectable for EdwardsPoint

source§

fn conditional_select( a: &EdwardsPoint, b: &EdwardsPoint, choice: Choice ) -> EdwardsPoint

Select a or b according to choice. Read more
source§

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

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

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

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

impl ConstantTimeEq for EdwardsPoint

source§

fn ct_eq(&self, other: &EdwardsPoint) -> Choice

Determine if two items are equal. Read more
source§

impl Debug for EdwardsPoint

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for EdwardsPoint

source§

fn default() -> EdwardsPoint

Returns the “default value” for a type. Read more
source§

impl Identity for EdwardsPoint

source§

fn identity() -> EdwardsPoint

Returns the identity element of the curve. Can be used as a constructor.
source§

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

source§

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

Scalar multiplication: compute scalar * self.

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

§

type Output = EdwardsPoint

The resulting type after applying the * operator.
source§

impl<'b> Mul<&'b EdwardsPoint> for Scalar

§

type Output = EdwardsPoint

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b EdwardsPoint) -> EdwardsPoint

Performs the * operation. Read more
source§

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

source§

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

Scalar multiplication: compute scalar * self.

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

§

type Output = EdwardsPoint

The resulting type after applying the * operator.
source§

impl<'b> Mul<&'b Scalar> for EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the * operator.
source§

fn mul(self, rhs: &'b Scalar) -> EdwardsPoint

Performs the * operation. Read more
source§

impl<'a> Mul<EdwardsPoint> for &'a Scalar

§

type Output = EdwardsPoint

The resulting type after applying the * operator.
source§

fn mul(self, rhs: EdwardsPoint) -> EdwardsPoint

Performs the * operation. Read more
source§

impl Mul<EdwardsPoint> for Scalar

§

type Output = EdwardsPoint

The resulting type after applying the * operator.
source§

fn mul(self, rhs: EdwardsPoint) -> EdwardsPoint

Performs the * operation. Read more
source§

impl<'a> Mul<Scalar> for &'a EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Scalar) -> EdwardsPoint

Performs the * operation. Read more
source§

impl Mul<Scalar> for EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Scalar) -> EdwardsPoint

Performs the * operation. Read more
source§

impl<'b> MulAssign<&'b Scalar> for EdwardsPoint

source§

fn mul_assign(&mut self, scalar: &'b Scalar)

Performs the *= operation. Read more
source§

impl MulAssign<Scalar> for EdwardsPoint

source§

fn mul_assign(&mut self, rhs: Scalar)

Performs the *= operation. Read more
source§

impl<'a> Neg for &'a EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the - operator.
source§

fn neg(self) -> EdwardsPoint

Performs the unary - operation. Read more
source§

impl Neg for EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the - operator.
source§

fn neg(self) -> EdwardsPoint

Performs the unary - operation. Read more
source§

impl PartialEq<EdwardsPoint> for EdwardsPoint

source§

fn eq(&self, other: &EdwardsPoint) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, 'b> Sub<&'b EdwardsPoint> for &'a EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the - operator.
source§

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

Performs the - operation. Read more
source§

impl<'b> Sub<&'b EdwardsPoint> for EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the - operator.
source§

fn sub(self, rhs: &'b EdwardsPoint) -> EdwardsPoint

Performs the - operation. Read more
source§

impl<'a> Sub<EdwardsPoint> for &'a EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the - operator.
source§

fn sub(self, rhs: EdwardsPoint) -> EdwardsPoint

Performs the - operation. Read more
source§

impl Sub<EdwardsPoint> for EdwardsPoint

§

type Output = EdwardsPoint

The resulting type after applying the - operator.
source§

fn sub(self, rhs: EdwardsPoint) -> EdwardsPoint

Performs the - operation. Read more
source§

impl<'b> SubAssign<&'b EdwardsPoint> for EdwardsPoint

source§

fn sub_assign(&mut self, _rhs: &'b EdwardsPoint)

Performs the -= operation. Read more
source§

impl SubAssign<EdwardsPoint> for EdwardsPoint

source§

fn sub_assign(&mut self, rhs: EdwardsPoint)

Performs the -= operation. Read more
source§

impl<T> Sum<T> for EdwardsPointwhere T: Borrow<EdwardsPoint>,

source§

fn sum<I>(iter: I) -> Selfwhere I: Iterator<Item = T>,

Method which takes an iterator and generates Self from the elements by “summing up” the items.
source§

impl Copy for EdwardsPoint

source§

impl Eq for EdwardsPoint

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> ConditionallyNegatable for Twhere T: ConditionallySelectable, &'a T: for<'a> Neg<Output = T>,

source§

fn conditional_negate(&mut self, choice: Choice)

Negate self if choice == Choice(1); otherwise, leave it unchanged. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IsIdentity for Twhere T: ConstantTimeEq + Identity,

source§

fn is_identity(&self) -> bool

Return true if this element is the identity element of the curve.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.