Struct libsecp256k1_rs::secp256k1::Scalar [−][src]
A 256-bit scalar value.
Methods
impl Scalar
[src]
impl Scalar
pub fn clear(&mut self)
[src]
pub fn clear(&mut self)
Clear a scalar to prevent the leak of sensitive data.
pub fn set_int(&mut self, v: u32)
[src]
pub fn set_int(&mut self, v: u32)
Set a scalar to an unsigned integer.
pub fn bits(&self, offset: usize, count: usize) -> u32
[src]
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.
pub fn bits_var(&self, offset: usize, count: usize) -> u32
[src]
pub fn bits_var(&self, offset: usize, count: usize) -> u32
Access bits from a scalar. Not constant time.
pub fn add_in_place(&mut self, a: &Scalar, b: &Scalar) -> bool
[src]
pub fn add_in_place(&mut self, a: &Scalar, b: &Scalar) -> bool
Add two scalars together (modulo the group order). Returns whether it overflowed.
pub fn cadd_bit(&mut self, bit: usize, flag: bool)
[src]
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.
pub fn set_b32(&mut self, b32: &[u8; 32]) -> bool
[src]
pub fn set_b32(&mut self, b32: &[u8; 32]) -> bool
Set a scalar from a big endian byte array.
pub fn b32(&self) -> [u8; 32]
[src]
pub fn b32(&self) -> [u8; 32]
Convert a scalar to a byte array.
pub fn fill_b32(&self, bin: &mut [u8; 32])
[src]
pub fn fill_b32(&self, bin: &mut [u8; 32])
Convert a scalar to a byte array.
pub fn is_zero(&self) -> bool
[src]
pub fn is_zero(&self) -> bool
Check whether a scalar equals zero.
pub fn neg_in_place(&mut self, a: &Scalar)
[src]
pub fn neg_in_place(&mut self, a: &Scalar)
Compute the complement of a scalar (modulo the group order).
pub fn neg(&self) -> Scalar
[src]
pub fn neg(&self) -> Scalar
pub fn is_one(&self) -> bool
[src]
pub fn is_one(&self) -> bool
Check whether a scalar equals one.
pub fn is_high(&self) -> bool
[src]
pub fn is_high(&self) -> bool
Check whether a scalar is higher than the group order divided by 2.
pub fn cond_neg_mut(&mut self, flag: bool) -> isize
[src]
pub fn cond_neg_mut(&mut self, flag: bool) -> isize
Conditionally negate a number, in constant time. Returns -1 if the number was negated, 1 otherwise.
impl Scalar
[src]
impl Scalar
pub fn mul_in_place(&mut self, a: &Scalar, b: &Scalar)
[src]
pub fn mul_in_place(&mut self, a: &Scalar, b: &Scalar)
pub fn shr_int(&mut self, n: usize) -> u32
[src]
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)
[src]
pub fn sqr_in_place(&mut self, a: &Scalar)
pub fn sqr(&self) -> Scalar
[src]
pub fn sqr(&self) -> Scalar
pub fn inv_in_place(&mut self, x: &Scalar)
[src]
pub fn inv_in_place(&mut self, x: &Scalar)
pub fn inv(&self) -> Scalar
[src]
pub fn inv(&self) -> Scalar
pub fn inv_var(&self) -> Scalar
[src]
pub fn inv_var(&self) -> Scalar
pub fn is_even(&self) -> bool
[src]
pub fn is_even(&self) -> bool
Trait Implementations
impl Into<Scalar> for SecretKey
[src]
impl Into<Scalar> for SecretKey
impl Debug for Scalar
[src]
impl Debug for Scalar
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Scalar
[src]
impl Clone for Scalar
fn clone(&self) -> Scalar
[src]
fn clone(&self) -> Scalar
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Scalar
[src]
impl Copy for Scalar
impl Eq for Scalar
[src]
impl Eq for Scalar
impl PartialEq for Scalar
[src]
impl PartialEq for Scalar
fn eq(&self, other: &Scalar) -> bool
[src]
fn eq(&self, other: &Scalar) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Scalar) -> bool
[src]
fn ne(&self, other: &Scalar) -> bool
This method tests for !=
.
impl Default for Scalar
[src]
impl Default for Scalar
impl Add<Scalar> for Scalar
[src]
impl Add<Scalar> for Scalar
type Output = Scalar
The resulting type after applying the +
operator.
fn add(self, other: Scalar) -> Scalar
[src]
fn add(self, other: Scalar) -> Scalar
Performs the +
operation.
impl Neg for Scalar
[src]
impl Neg for Scalar
type Output = Scalar
The resulting type after applying the -
operator.
fn neg(self) -> Self::Output
[src]
fn neg(self) -> Self::Output
Performs the unary -
operation.
impl<'a, 'b> Add<&'a Scalar> for &'b Scalar
[src]
impl<'a, 'b> Add<&'a Scalar> for &'b Scalar
type Output = Scalar
The resulting type after applying the +
operator.
fn add(self, other: &'a Scalar) -> Scalar
[src]
fn add(self, other: &'a Scalar) -> Scalar
Performs the +
operation.
impl<'a> AddAssign<&'a Scalar> for Scalar
[src]
impl<'a> AddAssign<&'a Scalar> for Scalar
fn add_assign(&mut self, other: &'a Scalar)
[src]
fn add_assign(&mut self, other: &'a Scalar)
Performs the +=
operation.
impl AddAssign<Scalar> for Scalar
[src]
impl AddAssign<Scalar> for Scalar
fn add_assign(&mut self, other: Scalar)
[src]
fn add_assign(&mut self, other: Scalar)
Performs the +=
operation.
impl Mul<Scalar> for Scalar
[src]
impl Mul<Scalar> for Scalar
type Output = Scalar
The resulting type after applying the *
operator.
fn mul(self, other: Scalar) -> Scalar
[src]
fn mul(self, other: Scalar) -> Scalar
Performs the *
operation.
impl<'a, 'b> Mul<&'a Scalar> for &'b Scalar
[src]
impl<'a, 'b> Mul<&'a Scalar> for &'b Scalar
type Output = Scalar
The resulting type after applying the *
operator.
fn mul(self, other: &'a Scalar) -> Scalar
[src]
fn mul(self, other: &'a Scalar) -> Scalar
Performs the *
operation.
impl<'a> MulAssign<&'a Scalar> for Scalar
[src]
impl<'a> MulAssign<&'a Scalar> for Scalar
fn mul_assign(&mut self, other: &'a Scalar)
[src]
fn mul_assign(&mut self, other: &'a Scalar)
Performs the *=
operation.
impl MulAssign<Scalar> for Scalar
[src]
impl MulAssign<Scalar> for Scalar
fn mul_assign(&mut self, other: Scalar)
[src]
fn mul_assign(&mut self, other: Scalar)
Performs the *=
operation.