Expand description
A 256-bit scalar value.
Tuple Fields
0: [u32; 8]
Implementations
sourceimpl Scalar
impl Scalar
sourcepub fn bits(&self, offset: usize, count: usize) -> u32
pub fn bits(&self, offset: usize, count: usize) -> u32
Access bits from a scalar. All requested bits must belong to the same 32-bit limb.
sourcepub fn bits_var(&self, offset: usize, count: usize) -> u32
pub fn bits_var(&self, offset: usize, count: usize) -> u32
Access bits from a scalar. Not constant time.
sourcepub fn cadd_bit(&mut self, bit: usize, flag: bool)
pub fn cadd_bit(&mut self, bit: usize, flag: bool)
Conditionally add a power of two to a scalar. The result is not allowed to overflow.
sourcepub fn set_b32(&mut self, b32: &[u8; 32]) -> Choice
pub fn set_b32(&mut self, b32: &[u8; 32]) -> Choice
Set a scalar from a big endian byte array, return whether it overflowed.
sourcepub fn is_high(&self) -> bool
pub fn is_high(&self) -> bool
Check whether a scalar is higher than the group order divided by 2.
sourcepub fn cond_neg_assign(&mut self, flag: Choice)
pub fn cond_neg_assign(&mut self, flag: Choice)
Conditionally negate a number, in constant time.
sourceimpl Scalar
impl Scalar
pub fn mul_in_place(&mut self, a: &Scalar, b: &Scalar)
sourcepub fn shr_int(&mut self, n: usize) -> u32
pub fn shr_int(&mut self, n: usize) -> u32
Shift a scalar right by some amount strictly between 0 and 16, returning the low bits that were shifted off.
pub fn sqr_in_place(&mut self, a: &Scalar)
pub fn sqr(&self) -> Scalar
pub fn inv_in_place(&mut self, x: &Scalar)
pub fn inv(&self) -> Scalar
pub fn inv_var(&self) -> Scalar
pub fn is_even(&self) -> bool
Trait Implementations
sourceimpl<'a> AddAssign<&'a Scalar> for Scalar
impl<'a> AddAssign<&'a Scalar> for Scalar
sourcefn add_assign(&mut self, other: &'a Scalar)
fn add_assign(&mut self, other: &'a Scalar)
Performs the +=
operation. Read more
sourceimpl AddAssign<Scalar> for Scalar
impl AddAssign<Scalar> for Scalar
sourcefn add_assign(&mut self, other: Scalar)
fn add_assign(&mut self, other: Scalar)
Performs the +=
operation. Read more
sourceimpl<'a> MulAssign<&'a Scalar> for Scalar
impl<'a> MulAssign<&'a Scalar> for Scalar
sourcefn mul_assign(&mut self, other: &'a Scalar)
fn mul_assign(&mut self, other: &'a Scalar)
Performs the *=
operation. Read more
sourceimpl MulAssign<Scalar> for Scalar
impl MulAssign<Scalar> for Scalar
sourcefn mul_assign(&mut self, other: Scalar)
fn mul_assign(&mut self, other: Scalar)
Performs the *=
operation. Read more
impl Eq for Scalar
impl StructuralEq 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more