Struct salty::Scalar [−][src]
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.
Implementations
impl Scalar
[src]
pub fn ell() -> [u8; 32]
[src]
The order of the group, 2**252 + something something
pub fn from_bytes(bytes: &[u8; 32]) -> Self
[src]
pub fn as_bytes(&self) -> &[u8; 32]
[src]
pub fn to_bytes(&self) -> [u8; 32]
[src]
pub fn from_u256_le(x: &[u8; 32]) -> Scalar
[src]
pub fn from_u512_le(x: &[u8; 64]) -> Scalar
[src]
pub fn reduce(&self) -> Scalar
[src]
Reduce this Scalar
modulo \(\ell\).
pub fn is_canonical(&self) -> bool
[src]
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
[src]
Trait Implementations
impl<'a, 'b> Add<&'b Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the +
operator.
fn add(self, _rhs: &'b Scalar) -> Scalar
[src]
impl Clone for Scalar
[src]
fn clone(&self) -> Scalar
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Scalar
[src]
impl Default for Scalar
[src]
impl From<&'_ [u8; 32]> for Scalar
[src]
impl From<u64> for Scalar
[src]
impl<'a, 'b> Mul<&'b EdwardsPoint> for &'a Scalar
[src]
type Output = EdwardsPoint
The resulting type after applying the *
operator.
fn mul(self, point: &'b EdwardsPoint) -> EdwardsPoint
[src]
impl<'a, 'b> Mul<&'b MontgomeryPoint> for &'a Scalar
[src]
type Output = MontgomeryPoint
The resulting type after applying the *
operator.
fn mul(self, point: &'b MontgomeryPoint) -> MontgomeryPoint
[src]
impl<'a, 'b> Mul<&'b Scalar> for &'a MontgomeryPoint
[src]
Multiply this MontgomeryPoint
by a Scalar
.
type Output = MontgomeryPoint
The resulting type after applying the *
operator.
fn mul(self, scalar: &'b Scalar) -> MontgomeryPoint
[src]
Given self
\( = u_0(P) \), and a Scalar
\(n\), return \( u_0([n]P) \).
impl<'a, 'b> Mul<&'b Scalar> for &'a Scalar
[src]
type Output = Scalar
The resulting type after applying the *
operator.
fn mul(self, _rhs: &'b Scalar) -> Scalar
[src]
impl<'b> MulAssign<&'b Scalar> for MontgomeryPoint
[src]
fn mul_assign(&mut self, scalar: &'b Scalar)
[src]
impl PartialEq<Scalar> for Scalar
[src]
impl StructuralPartialEq for Scalar
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,