[−][src]Struct secp256k1::curve::Scalar
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 from_int(v: u32) -> Self
[src]
pub fn from_int(v: u32) -> Self
Create a scalar from 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.
#[must_use]
pub fn add_in_place(&mut self, a: &Scalar, b: &Scalar) -> bool
[src]
#[must_use]
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.
#[must_use]
pub fn set_b32(&mut self, b32: &[u8; 32]) -> bool
[src]
#[must_use]
pub fn set_b32(&mut self, b32: &[u8; 32]) -> bool
Set a scalar from a big endian byte array, return whether it overflowed.
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 PartialEq<Scalar> for Scalar
[src]
impl PartialEq<Scalar> for Scalar
impl Eq for Scalar
[src]
impl Eq for Scalar
impl Debug for Scalar
[src]
impl Debug 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
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
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
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
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)
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)
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)
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)
impl Clone for Scalar
[src]
impl Clone for Scalar
fn clone(&self) -> Scalar
[src]
fn clone(&self) -> Scalar
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 Default for Scalar
[src]
impl Default for Scalar
impl Into<Scalar> for SecretKey
[src]
impl Into<Scalar> for SecretKey
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
impl<T> Same for T
[src]
impl<T> Same for T
type Output = T
Should always be Self