Struct salty::Scalar[][src]

#[repr(C)]pub struct Scalar(pub [u8; 32]);

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.

impl Clone for Scalar[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.

impl<'a, 'b> Mul<&'b MontgomeryPoint> for &'a Scalar[src]

type Output = MontgomeryPoint

The resulting type after applying the * operator.

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.

impl<'b> MulAssign<&'b Scalar> for MontgomeryPoint[src]

impl PartialEq<Scalar> for Scalar[src]

impl StructuralPartialEq for Scalar[src]

Auto Trait Implementations

impl Send for Scalar

impl Sync for Scalar

impl Unpin for Scalar

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.