[−][src]Struct zerocaf::backend::u64::scalar::Scalar
The Scalar
struct represents an Scalar over the modulo
2^249 + 14490550575682688738086195780655237219
as 5 52-bit limbs
represented in radix 2^52
.
Methods
impl Scalar
[src][−]
pub const fn zero() -> Scalar
[src][−]
Return a Scalar with value = 0
.
pub const fn one() -> Scalar
[src][−]
Return a Scalar with value = 1
.
pub const fn minus_one() -> Scalar
[src][−]
Return a Scalar with value = -1 (mod l)
.
pub fn is_even(self) -> bool
[src][−]
Evaluate if a Scalar
is even or not.
pub fn into_bits(&self) -> [u8; 256]
[src][−]
Returns the bit representation of the given Scalar
as
an array of 256 bits represented as u8
.
pub fn compute_NAF(&self) -> [i8; 256]
[src][−]
Compute the Non-Adjacent Form of a given Scalar
.
pub fn compute_window_NAF(&self, width: u8) -> [i8; 256]
[src][−]
Compute the Windowed-Non-Adjacent Form of a given Scalar
.
Inputs
width
=> Represents the window-width i.e.width = 2^width
.
pub fn mod_2_pow_k(&self, k: u8) -> u8
[src][−]
Compute the result from Scalar (mod 2^k)
.
Panics
If the given k is > 32 (5 bits) as the value gets greater than the limb.
pub fn mods_2_pow_k(&self, w: u8) -> i8
[src][−]
Compute the result from Scalar (mods k)
.
Panics
If the given k > 32 (5 bits)
|| k == 0
as the value gets
greater than the limb.
pub fn from_bytes(bytes: &[u8; 32]) -> Scalar
[src][−]
Unpack a 32 byte / 256 bit Scalar into 5 52-bit limbs.
pub fn from_bytes_wide(_bytes: &[u8; 64]) -> Scalar
[src][−]
Reduce a 64 byte / 512 bit scalar mod l
pub fn to_bytes(&self) -> [u8; 32]
[src][−]
Pack the limbs of this Scalar
into 32 bytes
pub fn two_pow_k(exp: u64) -> Scalar
[src][−]
Given a k
: u64, compute 2^k
giving the resulting result
as a Scalar
.
See that the input must be between the range => 0..250.
Panics
If the input is greater than the Sub-group order.
pub fn half_without_mod(self) -> Scalar
[src][−]
Returns the half of an EVEN Scalar
.
This function performs almost 4x faster than the
Half
implementation but SHOULD be used carefully.
Panics
When the Scalar
provided is not even.
Trait Implementations
impl<'a, 'b> Add<&'b Scalar> for &'a Scalar
[src][+]
impl Add<Scalar> for Scalar
[src][+]
impl Clone for Scalar
[src][+]
impl Copy for Scalar
[src]
impl Debug for Scalar
[src][+]
impl From<i8> for Scalar
[src][+]
impl From<u128> for Scalar
[src][+]
impl From<u16> for Scalar
[src][+]
impl From<u32> for Scalar
[src][+]
impl From<u64> for Scalar
[src][+]
impl From<u8> for Scalar
[src][+]
impl<'a> Half for &'a Scalar
[src][+]
impl Identity for Scalar
[src][+]
impl Index<usize> for Scalar
[src][+]
impl IndexMut<usize> for Scalar
[src][+]
impl<'a, 'b> Mul<&'a Scalar> for &'b Scalar
[src][+]
impl<'a, 'b> Mul<&'a Scalar> for &'b ProjectivePoint
[src][+]
impl<'a, 'b> Mul<&'b Scalar> for &'a EdwardsPoint
[src][+]
impl<'a, 'b> Mul<&'b Scalar> for &'a RistrettoPoint
[src][+]
impl Mul<Scalar> for Scalar
[src][+]
impl Mul<Scalar> for EdwardsPoint
[src][+]
impl Mul<Scalar> for ProjectivePoint
[src][+]
impl Mul<Scalar> for RistrettoPoint
[src][+]
impl<'a> Neg for &'a Scalar
[src][+]
impl Neg for Scalar
[src][+]
impl Ord for Scalar
[src][+]
impl PartialEq<Scalar> for Scalar
[src][+]
impl PartialOrd<Scalar> for Scalar
[src][+]
impl<'a, 'b> Pow<&'b Scalar> for &'a Scalar
[src][+]
impl Shr<u8> for Scalar
[src][+]
impl<'a> Square for &'a Scalar
[src][+]
impl<'a, 'b> Sub<&'b Scalar> for &'a Scalar
[src][+]
impl Sub<Scalar> for Scalar
[src][+]
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
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,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[+]
V: MultiLane<T>,