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
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.
Compress this point to CompressedEdwardsY
format.
pub 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
pub 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.
Multiply by the cofactor: return \([8]P\).
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);
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
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the +
operator.
Performs the +
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the +
operator.
Performs the +
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the +
operator.
Performs the +
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the +
operator.
Performs the +
operation. Read more
Performs the +=
operation. Read more
Performs the +=
operation. Read more
Determine if two items are equal. Read more
Returns the “default value” for a type. Read more
Returns the identity element of the curve. Can be used as a constructor. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
Performs the *
operation. Read more
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.
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
Performs the *
operation. Read more
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.
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
Performs the *
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
Performs the *
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
Performs the *
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the *
operator.
Performs the *
operation. Read more
Performs the *=
operation. Read more
Performs the *=
operation. Read more
type Point = EdwardsPoint
type Point = EdwardsPoint
The type of point being multiplied, e.g., RistrettoPoint
.
fn 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
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
Performs the unary -
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
Performs the unary -
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
Performs the -
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
Performs the -
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
Performs the -
operation. Read more
type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the -
operator.
Performs the -
operation. Read more
Performs the -=
operation. Read more
Performs the -=
operation. Read more
type Point = EdwardsPoint
type Point = EdwardsPoint
The type of point being multiplied, e.g., RistrettoPoint
.
fn 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
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,
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
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
Mutably borrows from an owned value. Read more
impl<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,
Negate self
if choice == Choice(1)
; otherwise, leave it
unchanged. Read more
Return true if this element is the identity element of the curve.