Struct secp256k1::curve::Scalar
[−]
[src]
pub struct Scalar(pub [u32; 8]);
A 256-bit scalar value.
Methods
impl Scalar
[src]
fn clear(&mut self)
[src]
Clear a scalar to prevent the leak of sensitive data.
fn set_int(&mut self, v: u32)
[src]
Set a scalar to an unsigned integer.
fn bits(&self, offset: usize, count: usize) -> u32
[src]
Access bits from a scalar. All requested bits must belong to the same 32-bit limb.
fn bits_var(&self, offset: usize, count: usize) -> u32
[src]
Access bits from a scalar. Not constant time.
fn add_in_place(&mut self, a: &Scalar, b: &Scalar) -> bool
[src]
Add two scalars together (modulo the group order). Returns whether it overflowed.
fn cadd_bit(&mut self, bit: usize, flag: bool)
[src]
Conditionally add a power of two to a scalar. The result is not allowed to overflow.
fn set_b32(&mut self, b32: &[u8; 32]) -> bool
[src]
Set a scalar from a big endian byte array.
fn b32(&self) -> [u8; 32]
[src]
Convert a scalar to a byte array.
fn is_zero(&self) -> bool
[src]
Check whether a scalar equals zero.
fn neg_in_place(&mut self, a: &Scalar)
[src]
Compute the complement of a scalar (modulo the group order).
fn neg(&self) -> Scalar
[src]
fn is_one(&self) -> bool
[src]
Check whether a scalar equals one.
fn is_high(&self) -> bool
[src]
Check whether a scalar is higher than the group order divided by 2.
fn cond_neg_mut(&mut self, flag: bool) -> isize
[src]
Conditionally negate a number, in constant time. Returns -1 if the number was negated, 1 otherwise.
impl Scalar
[src]
fn mul_in_place(&mut self, a: &Scalar, b: &Scalar)
[src]
fn shr_int(&mut self, n: usize) -> u32
[src]
Shift a scalar right by some amount strictly between 0 and 16, returning the low bits that were shifted off.
fn sqr_in_place(&mut self, a: &Scalar)
[src]
fn sqr(&self) -> Scalar
[src]
fn inv_in_place(&mut self, x: &Scalar)
[src]
fn inv(&self) -> Scalar
[src]
fn inv_var(&self) -> Scalar
[src]
fn is_even(&self) -> bool
[src]
Trait Implementations
impl Debug for Scalar
[src]
impl Clone for Scalar
[src]
fn clone(&self) -> Scalar
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Eq for Scalar
[src]
impl PartialEq for Scalar
[src]
fn eq(&self, __arg_0: &Scalar) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Scalar) -> bool
[src]
This method tests for !=
.
impl Default for Scalar
[src]
impl Add<Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the +
operator.
fn add(self, other: Scalar) -> Scalar
[src]
Performs the +
operation.
impl<'a, 'b> Add<&'a Scalar> for &'b Scalar
[src]
type Output = Scalar
The resulting type after applying the +
operator.
fn add(self, other: &'a Scalar) -> Scalar
[src]
Performs the +
operation.
impl<'a> AddAssign<&'a Scalar> for Scalar
[src]
fn add_assign(&mut self, other: &'a Scalar)
[src]
Performs the +=
operation.
impl AddAssign<Scalar> for Scalar
[src]
fn add_assign(&mut self, other: Scalar)
[src]
Performs the +=
operation.
impl Mul<Scalar> for Scalar
[src]
type Output = Scalar
The resulting type after applying the *
operator.
fn mul(self, other: Scalar) -> Scalar
[src]
Performs the *
operation.
impl<'a, 'b> Mul<&'a Scalar> for &'b Scalar
[src]
type Output = Scalar
The resulting type after applying the *
operator.
fn mul(self, other: &'a Scalar) -> Scalar
[src]
Performs the *
operation.
impl<'a> MulAssign<&'a Scalar> for Scalar
[src]
fn mul_assign(&mut self, other: &'a Scalar)
[src]
Performs the *=
operation.
impl MulAssign<Scalar> for Scalar
[src]
fn mul_assign(&mut self, other: Scalar)
[src]
Performs the *=
operation.