Skip to main content

EdwardsPoint

Struct EdwardsPoint 

Source
pub struct EdwardsPoint<F: FieldOps> {
    pub x: F,
    pub y: F,
}
Expand description

An affine point on an Edwards curve, for any characteristic.

Fields§

§x: F

The x coordinate of a point.

§y: F

The y coordinate of a point.

Implementations§

Source§

impl<F: FieldOps> EdwardsPoint<F>

Source

pub fn new(x: F, y: F) -> Self

Construct an affine Edwards point. No on-curve check.

Source

pub fn identity() -> Self

The group identity.

  • Odd char: (0, 1)
  • Char 2: (0, 0)
Source

pub fn is_identity(&self) -> bool

Check whether this is the identity element.

Source§

impl<F: FieldOps> EdwardsPoint<F>

Source

pub fn negate(&self, _curve: &EdwardsCurve<F>) -> Self

Negate a point.

  • Odd char: -(x, y) = (-x, y)
  • Char 2: -(x, y) = (y, x)
Source

pub fn add(&self, other: &Self, curve: &EdwardsCurve<F>) -> Self

Add two points on the Edwards curve.

Source

pub fn double(&self, curve: &EdwardsCurve<F>) -> Self

Double a point. Both addition laws are strongly unified, so this just delegates to add.

Source

pub fn scalar_mul(&self, k: &[u64], curve: &EdwardsCurve<F>) -> Self

Scalar multiplication [k]P (constant-time double-and-add).

Source§

impl<F: FieldOps> EdwardsPoint<F>

Source

pub fn w_diff_add(w1: &F, w2: &F, w3: &F, curve: &EdwardsCurve<F>) -> F

Differential addition on the w-line (w = x + y, char 2 only).

Given w₁ = w(Q−P), w₂ = w(P), w₃ = w(Q), compute w₅ = w(P+Q).

Source

pub fn w_double(w2: &F, curve: &EdwardsCurve<F>) -> F

w-coordinate doubling (w = x + y, char 2 only).

Given w₂ = w(P), compute w₄ = w(2P).

Trait Implementations§

Source§

impl<F: Clone + FieldOps> Clone for EdwardsPoint<F>

Source§

fn clone(&self) -> EdwardsPoint<F>

Returns a duplicate 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<F> ConditionallySelectable for EdwardsPoint<F>
where F: FieldOps + Copy,

Source§

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

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<F> ConstantTimeEq for EdwardsPoint<F>

Source§

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

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
Source§

impl<F: Debug + FieldOps> Debug for EdwardsPoint<F>

Source§

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

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

impl<F> Display for EdwardsPoint<F>
where F: FieldOps + Display,

Source§

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

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

impl<F: FieldOps> PartialEq for EdwardsPoint<F>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<F: FieldOps> PointOps for EdwardsPoint<F>

Source§

type BaseField = F

The base field $\mathbb{F}_{p^M}$
Source§

type Curve = EdwardsCurve<F>

The elliptic curve we’re working on
Source§

fn identity(_curve: &Self::Curve) -> Self

Returns the identity
Source§

fn is_identity(&self) -> bool

Returns true if and only if self is the identity
Source§

fn negate(&self, curve: &Self::Curve) -> Self

Negate a point
Source§

fn scalar_mul(&self, k: &[u64], curve: &Self::Curve) -> Self

Scalar multiplication [k]P (variable-time double-and-add). Read more
Source§

impl<F: Copy + FieldOps> Copy for EdwardsPoint<F>

Source§

impl<F: FieldOps> Eq for EdwardsPoint<F>

Auto Trait Implementations§

§

impl<F> Freeze for EdwardsPoint<F>
where F: Freeze,

§

impl<F> RefUnwindSafe for EdwardsPoint<F>
where F: RefUnwindSafe,

§

impl<F> Send for EdwardsPoint<F>
where F: Send,

§

impl<F> Sync for EdwardsPoint<F>
where F: Sync,

§

impl<F> Unpin for EdwardsPoint<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for EdwardsPoint<F>
where F: UnsafeUnpin,

§

impl<F> UnwindSafe for EdwardsPoint<F>
where F: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.