Struct libsecp256k1::curve::Scalar[][src]

pub struct Scalar(pub [u32; 8]);
Expand description

A 256-bit scalar value.

Implementations

impl Scalar[src]

pub fn clear(&mut self)[src]

Clear a scalar to prevent the leak of sensitive data.

pub fn set_int(&mut self, v: u32)[src]

Set a scalar to an unsigned integer.

pub fn from_int(v: u32) -> Scalar[src]

Create a scalar from an unsigned integer.

pub 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.

pub fn bits_var(&self, offset: usize, count: usize) -> u32[src]

Access bits from a scalar. Not constant time.

pub 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.

#[must_use]
pub fn set_b32(&mut self, b32: &[u8; 32]) -> Choice
[src]

Set a scalar from a big endian byte array, return whether it overflowed.

pub fn b32(&self) -> [u8; 32][src]

Convert a scalar to a byte array.

pub fn fill_b32(&self, bin: &mut [u8; 32])[src]

Convert a scalar to a byte array.

pub fn is_zero(&self) -> bool[src]

Check whether a scalar equals zero.

pub fn is_one(&self) -> bool[src]

Check whether a scalar equals one.

pub fn is_high(&self) -> bool[src]

Check whether a scalar is higher than the group order divided by 2.

pub fn cond_neg_assign(&mut self, flag: Choice)[src]

Conditionally negate a number, in constant time.

impl Scalar[src]

pub fn mul_in_place(&mut self, a: &Scalar, b: &Scalar)[src]

pub 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.

pub fn sqr_in_place(&mut self, a: &Scalar)[src]

pub fn sqr(&self) -> Scalar[src]

pub fn inv_in_place(&mut self, x: &Scalar)[src]

pub fn inv(&self) -> Scalar[src]

pub fn inv_var(&self) -> Scalar[src]

pub fn is_even(&self) -> bool[src]

Trait Implementations

impl<'a, 'b> Add<&'a Scalar> for &'b Scalar[src]

type Output = Scalar

The resulting type after applying the + operator.

pub fn add(self, other: &'a Scalar) -> Scalar[src]

Performs the + operation. Read more

impl Add<Scalar> for Scalar[src]

type Output = Scalar

The resulting type after applying the + operator.

pub fn add(self, other: Scalar) -> Scalar[src]

Performs the + operation. Read more

impl<'a> AddAssign<&'a Scalar> for Scalar[src]

pub fn add_assign(&mut self, other: &'a Scalar)[src]

Performs the += operation. Read more

impl AddAssign<Scalar> for Scalar[src]

pub fn add_assign(&mut self, other: Scalar)[src]

Performs the += operation. Read more

impl Clone for Scalar[src]

pub 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 Debug for Scalar[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Default for Scalar[src]

pub fn default() -> Scalar[src]

Returns the “default value” for a type. Read more

impl Into<Scalar> for SecretKey[src]

fn into(self) -> Scalar[src]

Performs the conversion.

impl LowerHex for Scalar[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter.

impl<'a, 'b> Mul<&'a Scalar> for &'b Scalar[src]

type Output = Scalar

The resulting type after applying the * operator.

pub fn mul(self, other: &'a Scalar) -> Scalar[src]

Performs the * operation. Read more

impl Mul<Scalar> for Scalar[src]

type Output = Scalar

The resulting type after applying the * operator.

pub fn mul(self, other: Scalar) -> Scalar[src]

Performs the * operation. Read more

impl<'a> MulAssign<&'a Scalar> for Scalar[src]

pub fn mul_assign(&mut self, other: &'a Scalar)[src]

Performs the *= operation. Read more

impl MulAssign<Scalar> for Scalar[src]

pub fn mul_assign(&mut self, other: Scalar)[src]

Performs the *= operation. Read more

impl Neg for Scalar[src]

type Output = Scalar

The resulting type after applying the - operator.

pub fn neg(self) -> Scalar[src]

Performs the unary - operation. Read more

impl<'a> Neg for &'a Scalar[src]

type Output = Scalar

The resulting type after applying the - operator.

pub fn neg(self) -> Scalar[src]

Performs the unary - operation. Read more

impl PartialEq<Scalar> for Scalar[src]

pub fn eq(&self, other: &Scalar) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

pub fn ne(&self, other: &Scalar) -> bool[src]

This method tests for !=.

impl TryFrom<Scalar> for SecretKey[src]

type Error = Error

The type returned in the event of a conversion error.

fn try_from(scalar: Scalar) -> Result<Self, Error>[src]

Performs the conversion.

impl Copy for Scalar[src]

impl Eq for Scalar[src]

impl StructuralEq for Scalar[src]

impl StructuralPartialEq 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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V