Skip to main content

KummerPoint

Struct KummerPoint 

Source
pub struct KummerPoint<F: FieldOps + Copy> {
    pub x: F,
    pub z: F,
}
Expand description

A point on the Kummer line of a Montgomery curve, represented by (X : Z).

The affine x-coordinate is x = X / Z when Z ≠ 0. A conventional choice is:

  • (1 : 0) for the identity image,
  • (X : Z) with Z ≠ 0 for finite x-coordinates.

Fields§

§x: F

Projective x coordinate

§z: F

Projective z coordinate

Implementations§

Source§

impl<F: FieldOps> KummerPoint<F>

Source

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

Construct a projective x-line point (X : Z) without validation.

Source

pub fn from_x(x: F) -> Self

Construct the finite x-line point corresponding to the affine x-coordinate x, i.e. (x : 1).

Source

pub fn identity() -> Self

The image of the identity point on the Kummer line.

Source

pub fn is_identity(&self) -> bool

Return true if this point is the image of identity.

Source

pub fn to_x(&self) -> CtOption<F>

Attempt to recover the affine x-coordinate (succeeds when Z != 0).

Source§

impl<F: FieldOps + Copy> KummerPoint<F>

Source

pub fn xdouble(&self, curve: &MontgomeryCurve<F>) -> Self

Point doubling on the Kummer line.

Given x(P) in projective form (X:Z), compute x([2]P).

Source

pub fn xadd(&self, other: &Self, diff: &Self) -> Self

Differential addition. Given (in projective form (X:Z)):

  • self = x(P),
  • other = x(Q),
  • diff = x(P - Q),

compute x(P + Q).

Source

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

Montgomery ladder for scalar multiplication.

Given an x-line point x(P) and a scalar k, compute x([k]P). The scalar k is given as a slice of u64 limbs in little-endian order (same convention as FieldOps::pow).

Trait Implementations§

Source§

impl<F: Clone + FieldOps + Copy> Clone for KummerPoint<F>

Source§

fn clone(&self) -> KummerPoint<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 KummerPoint<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 KummerPoint<F>

Source§

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

Constant-time projective equality test on the Kummer line.

X1 Z2  ?=  X2 Z1
Source§

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

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

impl<F: Debug + FieldOps + Copy> Debug for KummerPoint<F>

Source§

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

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

impl<F> Display for KummerPoint<F>
where F: FieldOps + Copy + Display,

Source§

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

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

impl<F> PartialEq for KummerPoint<F>

Source§

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

Equality of projective x-line points.

A standard criterion is cross-multiplication:

X1 Z2 = X2 Z1.
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> PointOps for KummerPoint<F>
where F: FieldOps + Copy,

Source§

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

Return the identity image on the Kummer line.

Source§

fn is_identity(&self) -> bool

Return true if this is the identity image.

Source§

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

Negation is trivial on the Kummer line because P and -P have the same image.

Source§

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

Scalar multiplication is naturally implemented by the Montgomery ladder.

Source§

type BaseField = F

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

type Curve = MontgomeryCurve<F>

The elliptic curve we’re working on
Source§

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

Source§

impl<F> Eq for KummerPoint<F>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

§

impl<F> UnwindSafe for KummerPoint<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.