Struct curve25519_dalek::edwards::EdwardsPoint
source · [−]pub struct EdwardsPoint { /* private fields */ }
Expand description
An EdwardsPoint
represents a point on the Edwards form of Curve25519.
Implementations
sourceimpl EdwardsPoint
impl EdwardsPoint
sourcepub fn to_montgomery(&self) -> MontgomeryPoint
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.
sourcepub fn compress(&self) -> CompressedEdwardsY
pub fn compress(&self) -> CompressedEdwardsY
Compress this point to CompressedEdwardsY
format.
sourcepub fn hash_from_bytes<D>(bytes: &[u8]) -> EdwardsPoint where
D: Digest<OutputSize = U64> + Default,
pub fn hash_from_bytes<D>(bytes: &[u8]) -> EdwardsPoint where
D: Digest<OutputSize = U64> + Default,
Perform hashing to the group using the Elligator2 map
See https://tools.ietf.org/html/draft-irtf-cfrg-hash-to-curve-10#section-6.7.1
sourceimpl EdwardsPoint
impl EdwardsPoint
sourcepub fn vartime_double_scalar_mul_basepoint(
a: &Scalar,
A: &EdwardsPoint,
b: &Scalar
) -> EdwardsPoint
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.
sourceimpl EdwardsPoint
impl EdwardsPoint
sourcepub fn mul_by_cofactor(&self) -> EdwardsPoint
pub fn mul_by_cofactor(&self) -> EdwardsPoint
Multiply by the cofactor: return \([8]P\).
sourcepub fn is_small_order(&self) -> bool
pub fn is_small_order(&self) -> bool
Determine if this point is of small order.
Return
true
ifself
is in the torsion subgroup \( \mathcal E[8] \);false
ifself
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);
sourcepub fn is_torsion_free(&self) -> bool
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
ifself
has zero torsion component and is in the prime-order subgroup;false
ifself
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
sourceimpl<'a, 'b> Add<&'b EdwardsPoint> for &'a EdwardsPoint
impl<'a, 'b> Add<&'b EdwardsPoint> for &'a EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the +
operator.
sourcefn add(self, other: &'b EdwardsPoint) -> EdwardsPoint
fn add(self, other: &'b EdwardsPoint) -> EdwardsPoint
Performs the +
operation. Read more
sourceimpl<'b> Add<&'b EdwardsPoint> for EdwardsPoint
impl<'b> Add<&'b EdwardsPoint> for EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the +
operator.
sourcefn add(self, rhs: &'b EdwardsPoint) -> EdwardsPoint
fn add(self, rhs: &'b EdwardsPoint) -> EdwardsPoint
Performs the +
operation. Read more
sourceimpl<'a> Add<EdwardsPoint> for &'a EdwardsPoint
impl<'a> Add<EdwardsPoint> for &'a EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the +
operator.
sourcefn add(self, rhs: EdwardsPoint) -> EdwardsPoint
fn add(self, rhs: EdwardsPoint) -> EdwardsPoint
Performs the +
operation. Read more
sourceimpl Add<EdwardsPoint> for EdwardsPoint
impl Add<EdwardsPoint> for EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the +
operator.
sourcefn add(self, rhs: EdwardsPoint) -> EdwardsPoint
fn add(self, rhs: EdwardsPoint) -> EdwardsPoint
Performs the +
operation. Read more
sourceimpl<'b> AddAssign<&'b EdwardsPoint> for EdwardsPoint
impl<'b> AddAssign<&'b EdwardsPoint> for EdwardsPoint
sourcefn add_assign(&mut self, _rhs: &'b EdwardsPoint)
fn add_assign(&mut self, _rhs: &'b EdwardsPoint)
Performs the +=
operation. Read more
sourceimpl AddAssign<EdwardsPoint> for EdwardsPoint
impl AddAssign<EdwardsPoint> for EdwardsPoint
sourcefn add_assign(&mut self, rhs: EdwardsPoint)
fn add_assign(&mut self, rhs: EdwardsPoint)
Performs the +=
operation. Read more
sourceimpl Clone for EdwardsPoint
impl Clone for EdwardsPoint
sourcefn clone(&self) -> EdwardsPoint
fn clone(&self) -> EdwardsPoint
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl ConditionallySelectable for EdwardsPoint
impl ConditionallySelectable for EdwardsPoint
sourcefn conditional_select(
a: &EdwardsPoint,
b: &EdwardsPoint,
choice: Choice
) -> EdwardsPoint
fn conditional_select(
a: &EdwardsPoint,
b: &EdwardsPoint,
choice: Choice
) -> EdwardsPoint
Select a
or b
according to choice
. Read more
sourcefn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Conditionally assign other
to self
, according to choice
. Read more
sourceimpl ConstantTimeEq for EdwardsPoint
impl ConstantTimeEq for EdwardsPoint
sourcefn ct_eq(&self, other: &EdwardsPoint) -> Choice
fn ct_eq(&self, other: &EdwardsPoint) -> Choice
Determine if two items are equal. Read more
sourceimpl Debug for EdwardsPoint
impl Debug for EdwardsPoint
sourceimpl Default for EdwardsPoint
impl Default for EdwardsPoint
sourcefn default() -> EdwardsPoint
fn default() -> EdwardsPoint
Returns the “default value” for a type. Read more
sourceimpl Identity for EdwardsPoint
impl Identity for EdwardsPoint
sourcefn identity() -> EdwardsPoint
fn identity() -> EdwardsPoint
Returns the identity element of the curve. Can be used as a constructor. Read more
sourceimpl<'b> Mul<&'b EdwardsPoint> for Scalar
impl<'b> Mul<&'b EdwardsPoint> for Scalar
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: &'b EdwardsPoint) -> EdwardsPoint
fn mul(self, rhs: &'b EdwardsPoint) -> EdwardsPoint
Performs the *
operation. Read more
sourceimpl<'a, 'b> Mul<&'b EdwardsPoint> for &'a Scalar
impl<'a, 'b> Mul<&'b EdwardsPoint> for &'a Scalar
sourcefn mul(self, point: &'b EdwardsPoint) -> EdwardsPoint
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
type Output = EdwardsPoint
The resulting type after applying the *
operator.
sourceimpl<'b> Mul<&'b Scalar> for EdwardsPoint
impl<'b> Mul<&'b Scalar> for EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: &'b Scalar) -> EdwardsPoint
fn mul(self, rhs: &'b Scalar) -> EdwardsPoint
Performs the *
operation. Read more
sourceimpl<'a, 'b> Mul<&'b Scalar> for &'a EdwardsPoint
impl<'a, 'b> Mul<&'b Scalar> for &'a EdwardsPoint
sourcefn mul(self, scalar: &'b Scalar) -> EdwardsPoint
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
type Output = EdwardsPoint
The resulting type after applying the *
operator.
sourceimpl<'a> Mul<EdwardsPoint> for &'a Scalar
impl<'a> Mul<EdwardsPoint> for &'a Scalar
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: EdwardsPoint) -> EdwardsPoint
fn mul(self, rhs: EdwardsPoint) -> EdwardsPoint
Performs the *
operation. Read more
sourceimpl Mul<EdwardsPoint> for Scalar
impl Mul<EdwardsPoint> for Scalar
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: EdwardsPoint) -> EdwardsPoint
fn mul(self, rhs: EdwardsPoint) -> EdwardsPoint
Performs the *
operation. Read more
sourceimpl<'a> Mul<Scalar> for &'a EdwardsPoint
impl<'a> Mul<Scalar> for &'a EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: Scalar) -> EdwardsPoint
fn mul(self, rhs: Scalar) -> EdwardsPoint
Performs the *
operation. Read more
sourceimpl Mul<Scalar> for EdwardsPoint
impl Mul<Scalar> for EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
sourcefn mul(self, rhs: Scalar) -> EdwardsPoint
fn mul(self, rhs: Scalar) -> EdwardsPoint
Performs the *
operation. Read more
sourceimpl<'b> MulAssign<&'b Scalar> for EdwardsPoint
impl<'b> MulAssign<&'b Scalar> for EdwardsPoint
sourcefn mul_assign(&mut self, scalar: &'b Scalar)
fn mul_assign(&mut self, scalar: &'b Scalar)
Performs the *=
operation. Read more
sourceimpl MulAssign<Scalar> for EdwardsPoint
impl MulAssign<Scalar> for EdwardsPoint
sourcefn mul_assign(&mut self, rhs: Scalar)
fn mul_assign(&mut self, rhs: Scalar)
Performs the *=
operation. Read more
sourceimpl MultiscalarMul for EdwardsPoint
impl MultiscalarMul for EdwardsPoint
type Point = EdwardsPoint
type Point = EdwardsPoint
The type of point being multiplied, e.g., RistrettoPoint
.
sourcefn multiscalar_mul<I, J>(scalars: I, points: J) -> EdwardsPoint where
I: IntoIterator,
I::Item: Borrow<Scalar>,
J: IntoIterator,
J::Item: Borrow<EdwardsPoint>,
fn multiscalar_mul<I, J>(scalars: I, points: J) -> EdwardsPoint where
I: IntoIterator,
I::Item: Borrow<Scalar>,
J: IntoIterator,
J::Item: Borrow<EdwardsPoint>,
Given an iterator of (possibly secret) scalars and an iterator of public points, compute $$ Q = c_1 P_1 + \cdots + c_n P_n. $$ Read more
sourceimpl<'a> Neg for &'a EdwardsPoint
impl<'a> Neg for &'a EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
sourcefn neg(self) -> EdwardsPoint
fn neg(self) -> EdwardsPoint
Performs the unary -
operation. Read more
sourceimpl Neg for EdwardsPoint
impl Neg for EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
sourcefn neg(self) -> EdwardsPoint
fn neg(self) -> EdwardsPoint
Performs the unary -
operation. Read more
sourceimpl PartialEq<EdwardsPoint> for EdwardsPoint
impl PartialEq<EdwardsPoint> for EdwardsPoint
sourceimpl<'a, 'b> Sub<&'b EdwardsPoint> for &'a EdwardsPoint
impl<'a, 'b> Sub<&'b EdwardsPoint> for &'a EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
sourcefn sub(self, other: &'b EdwardsPoint) -> EdwardsPoint
fn sub(self, other: &'b EdwardsPoint) -> EdwardsPoint
Performs the -
operation. Read more
sourceimpl<'b> Sub<&'b EdwardsPoint> for EdwardsPoint
impl<'b> Sub<&'b EdwardsPoint> for EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: &'b EdwardsPoint) -> EdwardsPoint
fn sub(self, rhs: &'b EdwardsPoint) -> EdwardsPoint
Performs the -
operation. Read more
sourceimpl<'a> Sub<EdwardsPoint> for &'a EdwardsPoint
impl<'a> Sub<EdwardsPoint> for &'a EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: EdwardsPoint) -> EdwardsPoint
fn sub(self, rhs: EdwardsPoint) -> EdwardsPoint
Performs the -
operation. Read more
sourceimpl Sub<EdwardsPoint> for EdwardsPoint
impl Sub<EdwardsPoint> for EdwardsPoint
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
sourcefn sub(self, rhs: EdwardsPoint) -> EdwardsPoint
fn sub(self, rhs: EdwardsPoint) -> EdwardsPoint
Performs the -
operation. Read more
sourceimpl<'b> SubAssign<&'b EdwardsPoint> for EdwardsPoint
impl<'b> SubAssign<&'b EdwardsPoint> for EdwardsPoint
sourcefn sub_assign(&mut self, _rhs: &'b EdwardsPoint)
fn sub_assign(&mut self, _rhs: &'b EdwardsPoint)
Performs the -=
operation. Read more
sourceimpl SubAssign<EdwardsPoint> for EdwardsPoint
impl SubAssign<EdwardsPoint> for EdwardsPoint
sourcefn sub_assign(&mut self, rhs: EdwardsPoint)
fn sub_assign(&mut self, rhs: EdwardsPoint)
Performs the -=
operation. Read more
sourceimpl<T> Sum<T> for EdwardsPoint where
T: Borrow<EdwardsPoint>,
impl<T> Sum<T> for EdwardsPoint where
T: Borrow<EdwardsPoint>,
sourceimpl VartimeMultiscalarMul for EdwardsPoint
impl VartimeMultiscalarMul for EdwardsPoint
type Point = EdwardsPoint
type Point = EdwardsPoint
The type of point being multiplied, e.g., RistrettoPoint
.
sourcefn optional_multiscalar_mul<I, J>(scalars: I, points: J) -> Option<EdwardsPoint> where
I: IntoIterator,
I::Item: Borrow<Scalar>,
J: IntoIterator<Item = Option<EdwardsPoint>>,
fn optional_multiscalar_mul<I, J>(scalars: I, points: J) -> Option<EdwardsPoint> where
I: IntoIterator,
I::Item: Borrow<Scalar>,
J: IntoIterator<Item = Option<EdwardsPoint>>,
Given an iterator of public scalars and an iterator of
Option
s of points, compute either Some(Q)
, where
$$
Q = c_1 P_1 + \cdots + c_n P_n,
$$
if all points were Some(P_i)
, or else return None
. Read more
sourcefn 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,
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,
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
sourceimpl Zeroize for EdwardsPoint
impl Zeroize for EdwardsPoint
impl Copy for EdwardsPoint
impl Eq for EdwardsPoint
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ConditionallyNegatable for T where
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
impl<T> ConditionallyNegatable for T where
T: ConditionallySelectable,
&'a T: for<'a> Neg,
<&'a T as Neg>::Output == T,
sourcepub fn conditional_negate(&mut self, choice: Choice)
pub fn conditional_negate(&mut self, choice: Choice)
Negate self
if choice == Choice(1)
; otherwise, leave it
unchanged. Read more
sourceimpl<T> IsIdentity for T where
T: ConstantTimeEq + Identity,
impl<T> IsIdentity for T where
T: ConstantTimeEq + Identity,
sourcefn is_identity(&self) -> bool
fn is_identity(&self) -> bool
Return true if this element is the identity element of the curve.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more