Struct salty::MontgomeryPoint
source · pub struct MontgomeryPoint(pub FieldElement);
Expand description
Holds the \(u\)-coordinate of a point on the Montgomery form of Curve25519 or its twist.
Tuple Fields§
§0: FieldElement
Implementations§
source§impl MontgomeryPoint
impl MontgomeryPoint
sourcepub fn to_edwards(&self, sign: u8) -> Result<EdwardsPoint>
pub fn to_edwards(&self, sign: u8) -> Result<EdwardsPoint>
Attempt to convert to an EdwardsPoint
, using the supplied
choice of sign for the EdwardsPoint
.
Inputs
sign
: au8
donating the desired sign of the resultingEdwardsPoint
.0
denotes positive and1
negative.
Return
-
Some(EdwardsPoint)
ifself
is the \(u\)-coordinate of a point on (the Montgomery form of) Curve25519; -
None
ifself
is the \(u\)-coordinate of a point on the twist of (the Montgomery form of) Curve25519;
pub fn basepoint() -> Self
Trait Implementations§
source§impl Clone for MontgomeryPoint
impl Clone for MontgomeryPoint
source§fn clone(&self) -> MontgomeryPoint
fn clone(&self) -> MontgomeryPoint
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl ConstantTimeEq for MontgomeryPoint
impl ConstantTimeEq for MontgomeryPoint
source§impl Debug for MontgomeryPoint
impl Debug for MontgomeryPoint
source§impl Default for MontgomeryPoint
impl Default for MontgomeryPoint
source§fn default() -> MontgomeryPoint
fn default() -> MontgomeryPoint
Returns the “default value” for a type. Read more
source§impl<'a, 'b> Mul<&'b MontgomeryPoint> for &'a Scalar
impl<'a, 'b> Mul<&'b MontgomeryPoint> for &'a Scalar
§type Output = MontgomeryPoint
type Output = MontgomeryPoint
The resulting type after applying the
*
operator.source§fn mul(self, point: &'b MontgomeryPoint) -> MontgomeryPoint
fn mul(self, point: &'b MontgomeryPoint) -> MontgomeryPoint
Performs the
*
operation. Read moresource§impl<'a, 'b> Mul<&'b Scalar> for &'a MontgomeryPoint
impl<'a, 'b> Mul<&'b Scalar> for &'a MontgomeryPoint
Multiply this MontgomeryPoint
by a Scalar
.
source§fn mul(self, scalar: &'b Scalar) -> MontgomeryPoint
fn mul(self, scalar: &'b Scalar) -> MontgomeryPoint
Given self
\( = u_0(P) \), and a Scalar
\(n\), return \( u_0([n]P) \).
§type Output = MontgomeryPoint
type Output = MontgomeryPoint
The resulting type after applying the
*
operator.source§impl<'b> MulAssign<&'b Scalar> for MontgomeryPoint
impl<'b> MulAssign<&'b Scalar> for MontgomeryPoint
source§fn mul_assign(&mut self, scalar: &'b Scalar)
fn mul_assign(&mut self, scalar: &'b Scalar)
Performs the
*=
operation. Read moresource§impl PartialEq for MontgomeryPoint
impl PartialEq for MontgomeryPoint
source§fn eq(&self, other: &MontgomeryPoint) -> bool
fn eq(&self, other: &MontgomeryPoint) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Zeroize for MontgomeryPoint
impl Zeroize for MontgomeryPoint
impl Copy for MontgomeryPoint
impl Eq for MontgomeryPoint
Auto Trait Implementations§
impl RefUnwindSafe for MontgomeryPoint
impl Send for MontgomeryPoint
impl Sync for MontgomeryPoint
impl Unpin for MontgomeryPoint
impl UnwindSafe for MontgomeryPoint
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
Mutably borrows from an owned value. Read more