Struct curve25519_dalek::edwards::EdwardsPoint [−][src]
pub struct EdwardsPoint {
pub(crate) X: FieldElement51,
pub(crate) Y: FieldElement51,
pub(crate) Z: FieldElement51,
pub(crate) T: FieldElement51,
}
Expand description
An EdwardsPoint
represents a point on the Edwards form of Curve25519.
Fields
X: FieldElement51
Y: FieldElement51
Z: FieldElement51
T: FieldElement51
Implementations
Convert to a ProjectiveNielsPoint
Convert the representation of this point from extended coordinates to projective coordinates.
Free.
Dehomogenize to a AffineNielsPoint. Mainly for testing.
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
Add this point to itself.
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\).
Compute \([2^k] P \) by successive doublings. Requires \( k > 0 \).
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 = CompletedPoint
type Output = CompletedPoint
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 = CompletedPoint
type Output = CompletedPoint
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
impl<'a> From<&'a EdwardsPoint> for LookupTable<CachedPoint>
This is supported on target feature avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.
impl<'a> From<&'a EdwardsPoint> for LookupTable<CachedPoint>
avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.Performs the conversion.
impl<'a> From<&'a EdwardsPoint> for NafLookupTable5<CachedPoint>
This is supported on target feature avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.
impl<'a> From<&'a EdwardsPoint> for NafLookupTable5<CachedPoint>
avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
impl<'a> From<&'a EdwardsPoint> for NafLookupTable8<CachedPoint>
This is supported on target feature avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.
impl<'a> From<&'a EdwardsPoint> for NafLookupTable8<CachedPoint>
avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.Performs the conversion.
impl<'a> From<&'a EdwardsPoint> for LookupTable<CachedPoint>
This is supported on crate feature simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.
impl<'a> From<&'a EdwardsPoint> for LookupTable<CachedPoint>
simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.Performs the conversion.
impl<'a> From<&'a EdwardsPoint> for NafLookupTable5<CachedPoint>
This is supported on crate feature simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.
impl<'a> From<&'a EdwardsPoint> for NafLookupTable5<CachedPoint>
simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.Performs the conversion.
impl<'a> From<&'a EdwardsPoint> for NafLookupTable8<CachedPoint>
This is supported on crate feature simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.
impl<'a> From<&'a EdwardsPoint> for NafLookupTable8<CachedPoint>
simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
Performs the conversion.
impl From<EdwardsPoint> for ExtendedPoint
This is supported on target feature avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.
impl From<EdwardsPoint> for ExtendedPoint
avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.Performs the conversion.
impl From<EdwardsPoint> for ExtendedPoint
This is supported on crate feature simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.
impl From<EdwardsPoint> for ExtendedPoint
simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.Performs the conversion.
impl From<ExtendedPoint> for EdwardsPoint
This is supported on target feature avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.
impl From<ExtendedPoint> for EdwardsPoint
avx2
and non-target feature avx512ifma
and crate feature simd_backend
and (target features avx2
or avx512ifma
) only.Performs the conversion.
impl From<ExtendedPoint> for EdwardsPoint
This is supported on crate feature simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.
impl From<ExtendedPoint> for EdwardsPoint
simd_backend
and (target features avx2
or avx512ifma
) and target feature avx512ifma
only.Performs the conversion.
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 = CompletedPoint
type Output = CompletedPoint
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 = CompletedPoint
type Output = CompletedPoint
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
pub fn cast(self) -> U
pub fn cast(self) -> U
Numeric cast from self
to T
.
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
pub fn from_bits(t: T) -> T
pub fn from_bits(t: T) -> T
Safe lossless bitwise transmute from T
to Self
.
pub fn from_cast(t: T) -> T
pub fn from_cast(t: T) -> T
Numeric cast from T
to Self
.
pub fn into_bits(self) -> U
pub fn into_bits(self) -> U
Safe lossless bitwise transmute from self
to T
.
Return true if this element is the identity element of the curve.