Struct curve25519_dalek::montgomery::MontgomeryPoint
source · pub struct MontgomeryPoint(pub [u8; 32]);
Expand description
Holds the \(u\)-coordinate of a point on the Montgomery form of Curve25519 or its twist.
Tuple Fields§
§0: [u8; 32]
Implementations§
source§impl MontgomeryPoint
impl MontgomeryPoint
sourcepub fn mul_base(scalar: &Scalar) -> Self
pub fn mul_base(scalar: &Scalar) -> Self
Fixed-base scalar multiplication (i.e. multiplication by the base point).
sourcepub fn mul_clamped(self, bytes: [u8; 32]) -> Self
pub fn mul_clamped(self, bytes: [u8; 32]) -> Self
Multiply this point by clamp_integer(bytes)
. For a description of clamping, see
clamp_integer
.
sourcepub fn mul_base_clamped(bytes: [u8; 32]) -> Self
pub fn mul_base_clamped(bytes: [u8; 32]) -> Self
Multiply the basepoint by clamp_integer(bytes)
. For a description of clamping, see
clamp_integer
.
sourcepub fn to_edwards(&self, sign: u8) -> Option<EdwardsPoint>
pub fn to_edwards(&self, sign: u8) -> Option<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;
Trait Implementations§
source§impl Clone for MontgomeryPoint
impl Clone for MontgomeryPoint
source§fn clone(&self) -> MontgomeryPoint
fn clone(&self) -> MontgomeryPoint
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ConstantTimeEq for MontgomeryPoint
impl ConstantTimeEq for MontgomeryPoint
Equality of MontgomeryPoint
s is defined mod p.
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
source§impl<'de> Deserialize<'de> for MontgomeryPoint
impl<'de> Deserialize<'de> for MontgomeryPoint
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Hash for MontgomeryPoint
impl Hash for MontgomeryPoint
source§impl Identity for MontgomeryPoint
impl Identity for MontgomeryPoint
source§fn identity() -> MontgomeryPoint
fn identity() -> MontgomeryPoint
Return the group identity element, which has order 4.
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
*
operator.source§fn mul(self, point: &'b MontgomeryPoint) -> MontgomeryPoint
fn mul(self, point: &'b MontgomeryPoint) -> MontgomeryPoint
*
operation. Read moresource§impl<'b> Mul<&'b MontgomeryPoint> for Scalar
impl<'b> Mul<&'b MontgomeryPoint> for Scalar
§type Output = MontgomeryPoint
type Output = MontgomeryPoint
*
operator.source§fn mul(self, rhs: &'b MontgomeryPoint) -> MontgomeryPoint
fn mul(self, rhs: &'b MontgomeryPoint) -> MontgomeryPoint
*
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
*
operator.source§impl<'b> Mul<&'b Scalar> for MontgomeryPoint
impl<'b> Mul<&'b Scalar> for MontgomeryPoint
§type Output = MontgomeryPoint
type Output = MontgomeryPoint
*
operator.source§impl<'a> Mul<MontgomeryPoint> for &'a Scalar
impl<'a> Mul<MontgomeryPoint> for &'a Scalar
§type Output = MontgomeryPoint
type Output = MontgomeryPoint
*
operator.source§fn mul(self, rhs: MontgomeryPoint) -> MontgomeryPoint
fn mul(self, rhs: MontgomeryPoint) -> MontgomeryPoint
*
operation. Read moresource§impl Mul<MontgomeryPoint> for Scalar
impl Mul<MontgomeryPoint> for Scalar
§type Output = MontgomeryPoint
type Output = MontgomeryPoint
*
operator.source§fn mul(self, rhs: MontgomeryPoint) -> MontgomeryPoint
fn mul(self, rhs: MontgomeryPoint) -> MontgomeryPoint
*
operation. Read moresource§impl<'a> Mul<Scalar> for &'a MontgomeryPoint
impl<'a> Mul<Scalar> for &'a MontgomeryPoint
§type Output = MontgomeryPoint
type Output = MontgomeryPoint
*
operator.source§impl Mul<Scalar> for MontgomeryPoint
impl Mul<Scalar> for MontgomeryPoint
§type Output = MontgomeryPoint
type Output = MontgomeryPoint
*
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)
*=
operation. Read moresource§impl MulAssign<Scalar> for MontgomeryPoint
impl MulAssign<Scalar> for MontgomeryPoint
source§fn mul_assign(&mut self, rhs: Scalar)
fn mul_assign(&mut self, rhs: Scalar)
*=
operation. Read moresource§impl PartialEq<MontgomeryPoint> for MontgomeryPoint
impl PartialEq<MontgomeryPoint> for MontgomeryPoint
source§fn eq(&self, other: &MontgomeryPoint) -> bool
fn eq(&self, other: &MontgomeryPoint) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for MontgomeryPoint
impl Serialize for MontgomeryPoint
source§impl Zeroize for MontgomeryPoint
Available on crate feature zeroize
only.
impl Zeroize for MontgomeryPoint
zeroize
only.