pub struct EdwardsPoint(pub EdwardsPoint);
Expand description
Wrapper around the dalek Point type. For Ed25519, this is restricted to the prime subgroup.
Tuple Fields§
§0: EdwardsPoint
Implementations§
Source§impl EdwardsPoint
impl EdwardsPoint
pub fn mul_by_cofactor(&self) -> EdwardsPoint
Methods from Deref<Target = DEdwardsPoint>§
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 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§
Source§impl<'a> Add<&'a EdwardsPoint> for EdwardsPoint
impl<'a> Add<&'a EdwardsPoint> for EdwardsPoint
Source§type Output = EdwardsPoint
type Output = EdwardsPoint
+
operator.Source§impl Add for EdwardsPoint
impl Add for EdwardsPoint
Source§type Output = EdwardsPoint
type Output = EdwardsPoint
+
operator.Source§impl<'a> AddAssign<&'a EdwardsPoint> for EdwardsPoint
impl<'a> AddAssign<&'a EdwardsPoint> for EdwardsPoint
Source§fn add_assign(&mut self, other: &'a EdwardsPoint)
fn add_assign(&mut self, other: &'a EdwardsPoint)
+=
operation. Read moreSource§impl AddAssign for EdwardsPoint
impl AddAssign for EdwardsPoint
Source§fn add_assign(&mut self, other: EdwardsPoint)
fn add_assign(&mut self, other: EdwardsPoint)
+=
operation. Read moreSource§impl Borrow<EdwardsPoint> for &EdwardsPoint
impl Borrow<EdwardsPoint> for &EdwardsPoint
Source§fn borrow(&self) -> &DEdwardsPoint
fn borrow(&self) -> &DEdwardsPoint
Source§impl Borrow<EdwardsPoint> for EdwardsPoint
impl Borrow<EdwardsPoint> for EdwardsPoint
Source§fn borrow(&self) -> &DEdwardsPoint
fn borrow(&self) -> &DEdwardsPoint
Source§impl Clone for EdwardsPoint
impl Clone for EdwardsPoint
Source§fn clone(&self) -> EdwardsPoint
fn clone(&self) -> EdwardsPoint
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl ConditionallySelectable for EdwardsPoint
impl ConditionallySelectable for EdwardsPoint
Source§fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
self
and other
if choice == 1
; otherwise,
reassign both unto themselves. Read moreSource§impl ConstantTimeEq for EdwardsPoint
impl ConstantTimeEq for EdwardsPoint
Source§impl Debug for EdwardsPoint
impl Debug for EdwardsPoint
Source§impl Deref for EdwardsPoint
impl Deref for EdwardsPoint
Source§impl Group for EdwardsPoint
impl Group for EdwardsPoint
Source§impl GroupEncoding for EdwardsPoint
impl GroupEncoding for EdwardsPoint
Source§impl Hash for EdwardsPoint
impl Hash for EdwardsPoint
Source§impl<'a> Mul<&'a Scalar> for EdwardsPoint
impl<'a> Mul<&'a Scalar> for EdwardsPoint
Source§impl Mul<Scalar> for EdwardsPoint
impl Mul<Scalar> for EdwardsPoint
Source§impl<'a> MulAssign<&'a Scalar> for EdwardsPoint
impl<'a> MulAssign<&'a Scalar> for EdwardsPoint
Source§fn mul_assign(&mut self, other: &'a Scalar)
fn mul_assign(&mut self, other: &'a Scalar)
*=
operation. Read moreSource§impl MulAssign<Scalar> for EdwardsPoint
impl MulAssign<Scalar> for EdwardsPoint
Source§fn mul_assign(&mut self, other: Scalar)
fn mul_assign(&mut self, other: Scalar)
*=
operation. Read moreSource§impl Neg for EdwardsPoint
impl Neg for EdwardsPoint
Source§impl PartialEq for EdwardsPoint
impl PartialEq for EdwardsPoint
Source§impl<'a> Sub<&'a EdwardsPoint> for EdwardsPoint
impl<'a> Sub<&'a EdwardsPoint> for EdwardsPoint
Source§type Output = EdwardsPoint
type Output = EdwardsPoint
-
operator.Source§impl Sub for EdwardsPoint
impl Sub for EdwardsPoint
Source§type Output = EdwardsPoint
type Output = EdwardsPoint
-
operator.Source§impl<'a> SubAssign<&'a EdwardsPoint> for EdwardsPoint
impl<'a> SubAssign<&'a EdwardsPoint> for EdwardsPoint
Source§fn sub_assign(&mut self, other: &'a EdwardsPoint)
fn sub_assign(&mut self, other: &'a EdwardsPoint)
-=
operation. Read moreSource§impl SubAssign for EdwardsPoint
impl SubAssign for EdwardsPoint
Source§fn sub_assign(&mut self, other: EdwardsPoint)
fn sub_assign(&mut self, other: EdwardsPoint)
-=
operation. Read moreSource§impl<'a> Sum<&'a EdwardsPoint> for EdwardsPoint
impl<'a> Sum<&'a EdwardsPoint> for EdwardsPoint
Source§fn sum<I: Iterator<Item = &'a EdwardsPoint>>(iter: I) -> EdwardsPoint
fn sum<I: Iterator<Item = &'a EdwardsPoint>>(iter: I) -> EdwardsPoint
Self
from the elements by “summing up”
the items.Source§impl Sum for EdwardsPoint
impl Sum for EdwardsPoint
Source§fn sum<I: Iterator<Item = EdwardsPoint>>(iter: I) -> EdwardsPoint
fn sum<I: Iterator<Item = EdwardsPoint>>(iter: I) -> EdwardsPoint
Self
from the elements by “summing up”
the items.Source§impl Zeroize for EdwardsPoint
impl Zeroize for EdwardsPoint
impl Copy for EdwardsPoint
impl Eq for EdwardsPoint
impl PrimeGroup for EdwardsPoint
impl StructuralPartialEq for EdwardsPoint
Auto Trait Implementations§
impl Freeze for EdwardsPoint
impl RefUnwindSafe for EdwardsPoint
impl Send for EdwardsPoint
impl Sync for EdwardsPoint
impl Unpin for EdwardsPoint
impl UnwindSafe for EdwardsPoint
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.impl<T, Rhs, Output> GroupOps<Rhs, Output> for T
impl<T, Rhs, Output> GroupOpsOwned<Rhs, Output> for T
impl<T, Rhs, Output> ScalarMul<Rhs, Output> for T
impl<T, Rhs, Output> ScalarMulOwned<Rhs, Output> for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 160 bytes