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 mul_bits_be(&self, bits: impl Iterator<Item = bool>) -> MontgomeryPoint
pub fn mul_bits_be(&self, bits: impl Iterator<Item = bool>) -> MontgomeryPoint
Given self
\( = u_0(P) \), and a big-endian bit representation of an integer
\(n\), return \( u_0([n]P) \). This is constant time in the length of bits
.
NOTE: You probably do not want to use this function. Almost every protocol built on
Curve25519 uses clamped multiplication, explained
here.
When in doubt, use Self::mul_clamped
.
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 Mul<&MontgomeryPoint> for &Scalar
impl Mul<&MontgomeryPoint> for &Scalar
§type Output = MontgomeryPoint
type Output = MontgomeryPoint
*
operator.source§fn mul(self, point: &MontgomeryPoint) -> MontgomeryPoint
fn mul(self, point: &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 Mul<&Scalar> for &MontgomeryPoint
impl Mul<&Scalar> for &MontgomeryPoint
Multiply this MontgomeryPoint
by a Scalar
.
source§fn mul(self, scalar: &Scalar) -> MontgomeryPoint
fn mul(self, scalar: &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 MulAssign<&Scalar> for MontgomeryPoint
impl MulAssign<&Scalar> for MontgomeryPoint
source§fn mul_assign(&mut self, scalar: &Scalar)
fn mul_assign(&mut self, scalar: &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 for MontgomeryPoint
impl PartialEq 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.impl Copy for MontgomeryPoint
impl Eq for MontgomeryPoint
Auto Trait Implementations§
impl Freeze for MontgomeryPoint
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
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> IsIdentity for Twhere
T: ConstantTimeEq + Identity,
impl<T> IsIdentity for Twhere
T: ConstantTimeEq + Identity,
source§fn is_identity(&self) -> bool
fn is_identity(&self) -> bool
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.