pub struct Scalar(/* private fields */);
Expand description
This is the scalar field size = 4q = 2^446 - 0x8335dc163bb124b65129c96fde933d8d723a70aadc873d6d54a7bb0d We can therefore use 14 saturated 32-bit limbs
Implementations§
Source§impl Scalar
impl Scalar
pub const fn one() -> Scalar
pub const fn zero() -> Scalar
pub fn bits(&self) -> Vec<bool>
pub fn from_bytes(bytes: [u8; 56]) -> Scalar
pub fn to_bytes(&self) -> [u8; 56]
pub fn invert(&self) -> Self
Sourcepub fn from_canonical_bytes(bytes: [u8; 57]) -> Option<Scalar>
pub fn from_canonical_bytes(bytes: [u8; 57]) -> Option<Scalar>
Attempt to construct a Scalar
from a canonical byte representation.
§Return
Some(s)
, wheres
is theScalar
corresponding tobytes
, ifbytes
is a canonical byte representation;None
ifbytes
is not a canonical byte representation.
Sourcepub fn to_bytes_rfc_8032(&self) -> [u8; 57]
pub fn to_bytes_rfc_8032(&self) -> [u8; 57]
Serialize the scalar into 57 bytes, per RFC 8032. Byte 56 will always be zero.
Sourcepub fn from_bytes_mod_order_wide(input: &[u8; 114]) -> Scalar
pub fn from_bytes_mod_order_wide(input: &[u8; 114]) -> Scalar
Construct a Scalar
by reducing a 912-bit little-endian integer
modulo the group order ℓ.
Trait Implementations§
Source§impl ConstantTimeEq for Scalar
impl ConstantTimeEq for Scalar
Source§impl<'p, 's> Mul<&'p DecafPoint> for &'s Scalar
impl<'p, 's> Mul<&'p DecafPoint> for &'s Scalar
Source§type Output = DecafPoint
type Output = DecafPoint
The resulting type after applying the
*
operator.Source§fn mul(self, point: &'p DecafPoint) -> DecafPoint
fn mul(self, point: &'p DecafPoint) -> DecafPoint
Performs the
*
operation. Read moreSource§impl<'a, 'b> Mul<&'b ExtendedPoint> for &'a Scalar
impl<'a, 'b> Mul<&'b ExtendedPoint> for &'a Scalar
Source§fn mul(self, point: &'b ExtendedPoint) -> ExtendedPoint
fn mul(self, point: &'b ExtendedPoint) -> ExtendedPoint
Scalar multiplication: compute scalar * self
.
Source§type Output = ExtendedPoint
type Output = ExtendedPoint
The resulting type after applying the
*
operator.Source§impl<'b> Mul<&'b ExtendedPoint> for Scalar
impl<'b> Mul<&'b ExtendedPoint> for Scalar
Source§type Output = ExtendedPoint
type Output = ExtendedPoint
The resulting type after applying the
*
operator.Source§fn mul(self, rhs: &'b ExtendedPoint) -> ExtendedPoint
fn mul(self, rhs: &'b ExtendedPoint) -> ExtendedPoint
Performs the
*
operation. Read moreSource§impl Mul<&MontgomeryPoint> for &Scalar
impl Mul<&MontgomeryPoint> for &Scalar
Source§type Output = MontgomeryPoint
type Output = MontgomeryPoint
The resulting type after applying the
*
operator.Source§fn mul(self, point: &MontgomeryPoint) -> MontgomeryPoint
fn mul(self, point: &MontgomeryPoint) -> MontgomeryPoint
Performs the
*
operation. Read moreSource§impl<'s, 'p> Mul<&'s Scalar> for &'p DecafPoint
Scalar Mul Operations
impl<'s, 'p> Mul<&'s Scalar> for &'p DecafPoint
Scalar Mul Operations
Source§type Output = DecafPoint
type Output = DecafPoint
The resulting type after applying the
*
operator.Source§impl<'a, 'b> Mul<&'b Scalar> for &'a ExtendedPoint
impl<'a, 'b> Mul<&'b Scalar> for &'a ExtendedPoint
Source§fn mul(self, scalar: &'b Scalar) -> ExtendedPoint
fn mul(self, scalar: &'b Scalar) -> ExtendedPoint
Scalar multiplication: compute scalar * self
.
Source§type Output = ExtendedPoint
type Output = ExtendedPoint
The resulting type after applying the
*
operator.Source§impl Mul<&Scalar> for &MontgomeryPoint
impl Mul<&Scalar> for &MontgomeryPoint
Source§type Output = MontgomeryPoint
type Output = MontgomeryPoint
The resulting type after applying the
*
operator.Source§impl<'b> Mul<&'b Scalar> for ExtendedPoint
impl<'b> Mul<&'b Scalar> for ExtendedPoint
Source§type Output = ExtendedPoint
type Output = ExtendedPoint
The resulting type after applying the
*
operator.Source§impl Mul<DecafPoint> for Scalar
impl Mul<DecafPoint> for Scalar
Source§type Output = DecafPoint
type Output = DecafPoint
The resulting type after applying the
*
operator.Source§fn mul(self, point: DecafPoint) -> DecafPoint
fn mul(self, point: DecafPoint) -> DecafPoint
Performs the
*
operation. Read moreSource§impl<'a> Mul<ExtendedPoint> for &'a Scalar
impl<'a> Mul<ExtendedPoint> for &'a Scalar
Source§type Output = ExtendedPoint
type Output = ExtendedPoint
The resulting type after applying the
*
operator.Source§fn mul(self, rhs: ExtendedPoint) -> ExtendedPoint
fn mul(self, rhs: ExtendedPoint) -> ExtendedPoint
Performs the
*
operation. Read moreSource§impl Mul<ExtendedPoint> for Scalar
impl Mul<ExtendedPoint> for Scalar
Source§type Output = ExtendedPoint
type Output = ExtendedPoint
The resulting type after applying the
*
operator.Source§fn mul(self, rhs: ExtendedPoint) -> ExtendedPoint
fn mul(self, rhs: ExtendedPoint) -> ExtendedPoint
Performs the
*
operation. Read moreSource§impl<'a> Mul<Scalar> for &'a ExtendedPoint
impl<'a> Mul<Scalar> for &'a ExtendedPoint
Source§type Output = ExtendedPoint
type Output = ExtendedPoint
The resulting type after applying the
*
operator.Source§impl Mul<Scalar> for DecafPoint
impl Mul<Scalar> for DecafPoint
Source§type Output = DecafPoint
type Output = DecafPoint
The resulting type after applying the
*
operator.Source§impl Mul<Scalar> for ExtendedPoint
impl Mul<Scalar> for ExtendedPoint
Source§type Output = ExtendedPoint
type Output = ExtendedPoint
The resulting type after applying the
*
operator.Source§impl<'b> MulAssign<&'b Scalar> for ExtendedPoint
impl<'b> MulAssign<&'b Scalar> for ExtendedPoint
Source§fn mul_assign(&mut self, scalar: &'b Scalar)
fn mul_assign(&mut self, scalar: &'b Scalar)
Performs the
*=
operation. Read moreSource§impl MulAssign<Scalar> for ExtendedPoint
impl MulAssign<Scalar> for ExtendedPoint
Source§fn mul_assign(&mut self, rhs: Scalar)
fn mul_assign(&mut self, rhs: Scalar)
Performs the
*=
operation. Read moreimpl Copy for Scalar
impl Eq for Scalar
Auto Trait Implementations§
impl Freeze for Scalar
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