#[repr(C)]pub struct Scalar(pub [u8; 32]);
Expand description
Since the curve is an abelian group, it has a module structure, consisting of these scalars. They are the integers modulo “ell”, where “ell” is 2**252 + something something.
Tuple Fields§
§0: [u8; 32]
Implementations§
source§impl Scalar
impl Scalar
pub fn from_bytes(bytes: &[u8; 32]) -> Self
pub fn as_bytes(&self) -> &[u8; 32]
pub fn to_bytes(&self) -> [u8; 32]
pub fn from_u256_le(x: &[u8; 32]) -> Scalar
pub fn from_u512_le(x: &[u8; 64]) -> Scalar
sourcepub fn is_canonical(&self) -> bool
pub fn is_canonical(&self) -> bool
Check whether this Scalar
is the canonical representative mod \(\ell\).
This is intended for uses like input validation, where variable-time code is acceptable.
pub fn one() -> Self
Trait Implementations§
source§impl<'a, 'b> Mul<&'b EdwardsPoint> for &'a Scalar
impl<'a, 'b> Mul<&'b EdwardsPoint> for &'a Scalar
§type Output = EdwardsPoint
type Output = EdwardsPoint
The resulting type after applying the
*
operator.source§fn mul(self, point: &'b EdwardsPoint) -> EdwardsPoint
fn mul(self, point: &'b EdwardsPoint) -> EdwardsPoint
Performs the
*
operation. Read moresource§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 Scalar
impl PartialEq for Scalar
impl StructuralPartialEq for Scalar
Auto Trait Implementations§
impl RefUnwindSafe for Scalar
impl Send for Scalar
impl Sync for Scalar
impl Unpin for Scalar
impl UnwindSafe for Scalar
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