pub struct BigInt(pub U512);
Expand description

A large integer representing a backend-agnostic field element.

Tuple Fields§

§0: U512

The wrapped value.

Implementations§

source§

impl BigInt

source

pub const fn from_words(val: [u64; 8]) -> Self

Create a BigInt from the given limbs.

source

pub const fn from_u32(val: u32) -> Self

Create a BigInt from the given u32.

source

pub fn from_be_hex(hex_str: &str) -> Self

Create a BigInt from the given hex string.

source

pub fn vartime_log2(&self) -> u32

Returns ceil(log_2(&self)).

Remarks

Runs in variable time with respect to self

source

pub fn inverse_fp(&self, p: &Self) -> Self

Compute the multiplicative inverse of self with respect to F*_p, where p is prime.

Remarks

This algorithm computes self^(p-2) in F*_p. This is the inverse as a consequence of Fermat’s Little Theorem. Since x != 0 is a generator of F_p: x^p-1 = x * x^p-2 = 1. This means x^p-2 is x^-1.

This algorithm runs in constant time.

p should be prime, but this isn’t enforced by the algorithm. Incorrect results may occur if p is not prime.

p should be larger than 2, but what in tarnation would you need this algorithm for in a unary or binary field?

TODO: Are there better algorithms?

Panics
  • If self == 0
  • If p == 0
source

pub fn pow_fp(&self, x: &Self, p: &Self) -> Self

Compute self to the x power in F_p using the fast powers algorithm.

Remarks

This algorithm runs in constant time.

x should be less than p.

Panics
  • If p is zero.
source

pub const ZERO: Self = _

The value 0.

source

pub const ONE: Self = _

The value 1.

Methods from Deref<Target = U512>§

source

pub fn adc(&self, rhs: &Uint<LIMBS>, carry: Limb) -> (Uint<LIMBS>, Limb)

Computes a + b + carry, returning the result along with the new carry.

source

pub fn saturating_add(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Perform saturating addition, returning MAX on overflow.

source

pub fn wrapping_add(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Perform wrapping addition, discarding overflow.

source

pub fn add_mod(&self, rhs: &Uint<LIMBS>, p: &Uint<LIMBS>) -> Uint<LIMBS>

Computes self + rhs mod p in constant time.

Assumes self + rhs as unbounded integer is < 2p.

source

pub fn add_mod_special(&self, rhs: &Uint<LIMBS>, c: Limb) -> Uint<LIMBS>

Computes self + rhs mod p in constant time for the special modulus p = MAX+1-c where c is small enough to fit in a single Limb.

Assumes self + rhs as unbounded integer is < 2p.

source

pub fn bitand(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Computes bitwise a & b.

source

pub fn wrapping_and(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Perform wrapping bitwise AND.

There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations

source

pub fn checked_and(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>

Perform checked bitwise AND, returning a CtOption which is_some always

source

pub fn not(&self) -> Uint<LIMBS>

Computes bitwise !a.

source

pub fn bitor(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Computes bitwise a & b.

source

pub fn wrapping_or(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Perform wrapping bitwise OR.

There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations

source

pub fn checked_or(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>

Perform checked bitwise OR, returning a CtOption which is_some always

source

pub fn bitxor(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Computes bitwise a ^ b.

source

pub fn wrapping_xor(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Perform wrapping bitwise `XOR``.

There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations

source

pub fn checked_xor(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>

Perform checked bitwise XOR, returning a CtOption which is_some always

source

pub fn bit_vartime(&self, index: usize) -> bool

Returns true if the bit at position index is set, false otherwise.

source

pub fn bits_vartime(&self) -> usize

Calculate the number of bits needed to represent this number.

source

pub fn leading_zeros(&self) -> usize

Calculate the number of leading zeros in the binary representation of this number.

source

pub fn trailing_zeros(&self) -> usize

Calculate the number of trailing zeros in the binary representation of this number.

source

pub fn bits(&self) -> usize

Calculate the number of bits needed to represent this number.

source

pub fn bit(&self, index: usize) -> CtChoice

Get the value of the bit at position index, as a truthy or falsy CtChoice. Returns the falsy value for indices out of range.

source

pub fn cmp_vartime(&self, rhs: &Uint<LIMBS>) -> Ordering

Returns the Ordering between self and rhs in variable time.

source

pub fn ct_div_rem_limb_with_reciprocal( &self, reciprocal: &Reciprocal ) -> (Uint<LIMBS>, Limb)

Computes self / rhs using a pre-made reciprocal, returns the quotient (q) and remainder (r).

source

pub fn div_rem_limb_with_reciprocal( &self, reciprocal: &CtOption<Reciprocal> ) -> CtOption<(Uint<LIMBS>, Limb)>

Computes self / rhs using a pre-made reciprocal, returns the quotient (q) and remainder (r).

source

pub fn div_rem_limb(&self, rhs: NonZero<Limb>) -> (Uint<LIMBS>, Limb)

Computes self / rhs, returns the quotient (q) and remainder (r).

source

pub fn const_rem(&self, rhs: &Uint<LIMBS>) -> (Uint<LIMBS>, CtChoice)

Computes self % rhs, returns the remainder and and the truthy value for is_some or the falsy value for is_none.

NOTE: Use only if you need to access const fn. Otherwise use Self::rem. This is variable only with respect to rhs.

When used with a fixed rhs, this function is constant-time with respect to self.

source

pub fn rem2k(&self, k: usize) -> Uint<LIMBS>

Computes self % 2^k. Faster than reduce since its a power of 2. Limited to 2^16-1 since Uint doesn’t support higher.

source

pub fn div_rem(&self, rhs: &NonZero<Uint<LIMBS>>) -> (Uint<LIMBS>, Uint<LIMBS>)

Computes self / rhs, returns the quotient, remainder.

source

pub fn rem(&self, rhs: &NonZero<Uint<LIMBS>>) -> Uint<LIMBS>

Computes self % rhs, returns the remainder.

source

pub fn wrapping_div(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Wrapped division is just normal division i.e. self / rhs There’s no way wrapping could ever happen. This function exists, so that all operations are accounted for in the wrapping operations.

Panics if rhs == 0.

source

pub fn checked_div(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>

Perform checked division, returning a CtOption which is_some only if the rhs != 0

source

pub fn wrapping_rem(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Wrapped (modular) remainder calculation is just self % rhs. There’s no way wrapping could ever happen. This function exists, so that all operations are accounted for in the wrapping operations.

Panics if rhs == 0.

source

pub fn checked_rem(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>

Perform checked reduction, returning a CtOption which is_some only if the rhs != 0

source

pub fn inv_mod2k_vartime(&self, k: usize) -> Uint<LIMBS>

Computes 1/self mod 2^k. This method is constant-time w.r.t. self but not k.

Conditions: self < 2^k and self must be odd

source

pub fn inv_mod2k(&self, k: usize) -> Uint<LIMBS>

Computes 1/self mod 2^k.

Conditions: self < 2^k and self must be odd

source

pub fn inv_odd_mod_bounded( &self, modulus: &Uint<LIMBS>, bits: usize, modulus_bits: usize ) -> (Uint<LIMBS>, CtChoice)

Computes the multiplicative inverse of self mod modulus, where modulus is odd. In other words self^-1 mod modulus. bits and modulus_bits are the bounds on the bit size of self and modulus, respectively (the inversion speed will be proportional to bits + modulus_bits). The second element of the tuple is the truthy value if an inverse exists, otherwise it is a falsy value.

Note: variable time in bits and modulus_bits.

The algorithm is the same as in GMP 6.2.1’s mpn_sec_invert.

source

pub fn inv_odd_mod(&self, modulus: &Uint<LIMBS>) -> (Uint<LIMBS>, CtChoice)

Computes the multiplicative inverse of self mod modulus, where modulus is odd. Returns (inverse, CtChoice::TRUE) if an inverse exists, otherwise (undefined, CtChoice::FALSE).

source

pub fn inv_mod(&self, modulus: &Uint<LIMBS>) -> (Uint<LIMBS>, CtChoice)

Computes the multiplicative inverse of self mod modulus. Returns (inverse, CtChoice::TRUE) if an inverse exists, otherwise (undefined, CtChoice::FALSE).

source

pub fn mul<const HLIMBS: usize>( &self, rhs: &Uint<HLIMBS> ) -> <Uint<HLIMBS> as ConcatMixed<Uint<LIMBS>>>::MixedOutputwhere Uint<HLIMBS>: ConcatMixed<Uint<LIMBS>>,

Multiply self by rhs, returning a concatenated “wide” result.

source

pub fn mul_wide<const HLIMBS: usize>( &self, rhs: &Uint<HLIMBS> ) -> (Uint<LIMBS>, Uint<HLIMBS>)

Compute “wide” multiplication, with a product twice the size of the input.

Returns a tuple containing the (lo, hi) components of the product.

Ordering note

Releases of crypto-bigint prior to v0.3 used (hi, lo) ordering instead. This has been changed for better consistency with the rest of the APIs in this crate.

For more info see: https://github.com/RustCrypto/crypto-bigint/issues/4

source

pub fn saturating_mul<const HLIMBS: usize>( &self, rhs: &Uint<HLIMBS> ) -> Uint<LIMBS>

Perform saturating multiplication, returning MAX on overflow.

source

pub fn wrapping_mul<const H: usize>(&self, rhs: &Uint<H>) -> Uint<LIMBS>

Perform wrapping multiplication, discarding overflow.

source

pub fn square(&self) -> <Uint<LIMBS> as Concat>::Outputwhere Uint<LIMBS>: Concat,

Square self, returning a concatenated “wide” result.

source

pub fn square_wide(&self) -> (Uint<LIMBS>, Uint<LIMBS>)

Square self, returning a “wide” result in two parts as (lo, hi).

source

pub fn mul_mod_special(&self, rhs: &Uint<LIMBS>, c: Limb) -> Uint<LIMBS>

Computes self * rhs mod p in constant time for the special modulus p = MAX+1-c where c is small enough to fit in a single Limb. For the modulus reduction, this function implements Algorithm 14.47 from the “Handbook of Applied Cryptography”, by A. Menezes, P. van Oorschot, and S. Vanstone, CRC Press, 1996.

source

pub fn wrapping_neg(&self) -> Uint<LIMBS>

Perform wrapping negation.

source

pub fn neg_mod(&self, p: &Uint<LIMBS>) -> Uint<LIMBS>

Computes -a mod p in constant time. Assumes self is in [0, p).

source

pub fn neg_mod_special(&self, c: Limb) -> Uint<LIMBS>

Computes -a mod p in constant time for the special modulus p = MAX+1-c where c is small enough to fit in a single Limb.

source

pub fn resize<const T: usize>(&self) -> Uint<T>

Construct a Uint<T> from the unsigned integer value, truncating the upper bits if the value is too large to be represented.

source

pub fn shl_vartime(&self, n: usize) -> Uint<LIMBS>

Computes self << shift.

NOTE: this operation is variable time with respect to n ONLY.

When used with a fixed n, this function is constant-time with respect to self.

source

pub fn shl(&self, shift: usize) -> Uint<LIMBS>

Computes self << n. Returns zero if n >= Self::BITS.

source

pub fn shr_vartime(&self, shift: usize) -> Uint<LIMBS>

Computes self >> n.

NOTE: this operation is variable time with respect to n ONLY.

When used with a fixed n, this function is constant-time with respect to self.

source

pub fn shr(&self, shift: usize) -> Uint<LIMBS>

Computes self << n. Returns zero if n >= Self::BITS.

source

pub fn sqrt(&self) -> Uint<LIMBS>

👎Deprecated since 0.5.3: This functionality will be moved to sqrt_vartime in a future release.
source

pub fn sqrt_vartime(&self) -> Uint<LIMBS>

Computes √(self) Uses Brent & Zimmermann, Modern Computer Arithmetic, v0.5.9, Algorithm 1.13

Callers can check if self is a square by squaring the result

source

pub fn wrapping_sqrt(&self) -> Uint<LIMBS>

👎Deprecated since 0.5.3: This functionality will be moved to wrapping_sqrt_vartime in a future release.
source

pub fn wrapping_sqrt_vartime(&self) -> Uint<LIMBS>

Wrapped sqrt is just normal √(self) There’s no way wrapping could ever happen. This function exists, so that all operations are accounted for in the wrapping operations.

source

pub fn checked_sqrt(&self) -> CtOption<Uint<LIMBS>>

👎Deprecated since 0.5.3: This functionality will be moved to checked_sqrt_vartime in a future release.
source

pub fn checked_sqrt_vartime(&self) -> CtOption<Uint<LIMBS>>

Perform checked sqrt, returning a CtOption which is_some only if the √(self)² == self

source

pub fn sbb(&self, rhs: &Uint<LIMBS>, borrow: Limb) -> (Uint<LIMBS>, Limb)

Computes a - (b + borrow), returning the result along with the new borrow.

source

pub fn saturating_sub(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Perform saturating subtraction, returning ZERO on underflow.

source

pub fn wrapping_sub(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>

Perform wrapping subtraction, discarding underflow and wrapping around the boundary of the type.

source

pub fn sub_mod(&self, rhs: &Uint<LIMBS>, p: &Uint<LIMBS>) -> Uint<LIMBS>

Computes self - rhs mod p in constant time.

Assumes self - rhs as unbounded signed integer is in [-p, p).

source

pub fn sub_mod_special(&self, rhs: &Uint<LIMBS>, c: Limb) -> Uint<LIMBS>

Computes self - rhs mod p in constant time for the special modulus p = MAX+1-c where c is small enough to fit in a single Limb.

Assumes self - rhs as unbounded signed integer is in [-p, p).

source

pub const ZERO: Uint<LIMBS> = _

source

pub const ONE: Uint<LIMBS> = _

source

pub const MAX: Uint<LIMBS> = _

source

pub const BITS: usize = _

source

pub const BYTES: usize = _

source

pub const LIMBS: usize = LIMBS

source

pub fn as_words(&self) -> &[u32; LIMBS]

Borrow the inner limbs as an array of Words.

source

pub fn as_limbs(&self) -> &[Limb; LIMBS]

Borrow the limbs of this Uint.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#49}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U64::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#52}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#52}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#54}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U128::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#57}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#57}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#59}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U256::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#62}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#62}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#64}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U384::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#67}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#67}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#69}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U512::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#72}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#72}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#74}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U640::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#77}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#77}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#79}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U768::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#82}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#82}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#84}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U896::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#87}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#87}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#89}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U1024::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#92}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#92}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#94}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U1280::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#97}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#97}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#99}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U1536::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#102}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#102}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#104}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U1792::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#107}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#107}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#109}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U2048::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#112}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#112}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#114}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U3072::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#117}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#117}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#119}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U3584::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#122}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#122}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#124}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U4096::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#127}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#127}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#129}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U4224::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#132}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#132}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#134}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U4352::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#137}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#137}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#139}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U6144::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#142}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#142}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#144}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U8192::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#147}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#147}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

source

pub fn concat( &self, lo: &Uint<crypto_bigint::::uint::{impl#149}::concat::{constant#0}> ) -> Uint<crypto_bigint::::uint::U16384::{constant#0}>

Concatenate the two values, with self as most significant and rhs as the least significant.

source

pub fn split( &self ) -> (Uint<crypto_bigint::::uint::{impl#152}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#152}::split::{constant#1}>)

Split this number in half, returning its high and low components respectively.

Trait Implementations§

source§

impl Clone for BigInt

source§

fn clone(&self) -> BigInt

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ConditionallySelectable for BigInt

source§

fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self

Select a or b according to choice. Read more
source§

fn conditional_assign(&mut self, other: &Self, choice: Choice)

Conditionally assign other to self, according to choice. Read more
source§

fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)

Conditionally swap self and other if choice == 1; otherwise, reassign both unto themselves. Read more
source§

impl Debug for BigInt

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for BigInt

§

type Target = Uint<crypto_bigint::::uint::U512::{constant#0}>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<T> From<T> for BigIntwhere T: Into<U512>,

source§

fn from(x: T) -> Self

Converts to this type from the input type.
source§

impl Hash for BigInt

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for BigInt

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<BigInt> for BigInt

source§

fn eq(&self, other: &BigInt) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<BigInt> for BigInt

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl TryFrom<&BigInt> for Scalar

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: &BigInt) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<BigInt> for Scalar

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(value: BigInt) -> Result<Self>

Performs the conversion.
source§

impl ZkpFrom<&Scalar> for BigInt

source§

impl ZkpFrom<Scalar> for BigInt

source§

impl Copy for BigInt

source§

impl Eq for BigInt

source§

impl StructuralEq for BigInt

source§

impl StructuralPartialEq for BigInt

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Qwhere Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
§

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

§

fn vzip(self) -> V

source§

impl<T, U> ZkpInto<T> for Uwhere T: ZkpFrom<U>,

source§

impl<N> NodeTrait for Nwhere N: Copy + Ord + Hash,