Struct sunscreen_zkp_backend::BigInt
source · 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
impl BigInt
sourcepub const fn from_words(val: [u64; 8]) -> Self
pub const fn from_words(val: [u64; 8]) -> Self
Create a BigInt
from the given limbs.
sourcepub fn from_be_hex(hex_str: &str) -> Self
pub fn from_be_hex(hex_str: &str) -> Self
Create a BigInt
from the given hex string.
sourcepub fn vartime_log2(&self) -> u32
pub fn vartime_log2(&self) -> u32
sourcepub fn inverse_fp(&self, p: &Self) -> Self
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
Methods from Deref<Target = U512>§
sourcepub fn adc(&self, rhs: &Uint<LIMBS>, carry: Limb) -> (Uint<LIMBS>, Limb)
pub fn adc(&self, rhs: &Uint<LIMBS>, carry: Limb) -> (Uint<LIMBS>, Limb)
Computes a + b + carry
, returning the result along with the new carry.
sourcepub fn saturating_add(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
pub fn saturating_add(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
Perform saturating addition, returning MAX
on overflow.
sourcepub fn wrapping_add(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
pub fn wrapping_add(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
Perform wrapping addition, discarding overflow.
sourcepub fn add_mod(&self, rhs: &Uint<LIMBS>, p: &Uint<LIMBS>) -> Uint<LIMBS>
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
.
sourcepub fn add_mod_special(&self, rhs: &Uint<LIMBS>, c: Limb) -> Uint<LIMBS>
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
.
sourcepub fn wrapping_and(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
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
sourcepub fn checked_and(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>
pub fn checked_and(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>
Perform checked bitwise AND
, returning a CtOption
which is_some
always
sourcepub fn wrapping_or(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
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
sourcepub fn checked_or(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>
pub fn checked_or(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>
Perform checked bitwise OR
, returning a CtOption
which is_some
always
sourcepub fn wrapping_xor(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
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
sourcepub fn checked_xor(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>
pub fn checked_xor(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>
Perform checked bitwise XOR
, returning a CtOption
which is_some
always
sourcepub fn bit_vartime(&self, index: usize) -> bool
pub fn bit_vartime(&self, index: usize) -> bool
Returns true
if the bit at position index
is set, false
otherwise.
sourcepub fn bits_vartime(&self) -> usize
pub fn bits_vartime(&self) -> usize
Calculate the number of bits needed to represent this number.
sourcepub fn leading_zeros(&self) -> usize
pub fn leading_zeros(&self) -> usize
Calculate the number of leading zeros in the binary representation of this number.
sourcepub fn trailing_zeros(&self) -> usize
pub fn trailing_zeros(&self) -> usize
Calculate the number of trailing zeros in the binary representation of this number.
sourcepub fn bit(&self, index: usize) -> CtChoice
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.
sourcepub fn cmp_vartime(&self, rhs: &Uint<LIMBS>) -> Ordering
pub fn cmp_vartime(&self, rhs: &Uint<LIMBS>) -> Ordering
Returns the Ordering between self
and rhs
in variable time.
sourcepub fn ct_div_rem_limb_with_reciprocal(
&self,
reciprocal: &Reciprocal
) -> (Uint<LIMBS>, Limb)
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).
sourcepub fn div_rem_limb_with_reciprocal(
&self,
reciprocal: &CtOption<Reciprocal>
) -> CtOption<(Uint<LIMBS>, Limb)>
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).
sourcepub fn div_rem_limb(&self, rhs: NonZero<Limb>) -> (Uint<LIMBS>, Limb)
pub fn div_rem_limb(&self, rhs: NonZero<Limb>) -> (Uint<LIMBS>, Limb)
Computes self
/ rhs
, returns the quotient (q) and remainder (r).
sourcepub fn const_rem(&self, rhs: &Uint<LIMBS>) -> (Uint<LIMBS>, CtChoice)
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
.
sourcepub fn rem2k(&self, k: usize) -> Uint<LIMBS>
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.
sourcepub fn div_rem(&self, rhs: &NonZero<Uint<LIMBS>>) -> (Uint<LIMBS>, Uint<LIMBS>)
pub fn div_rem(&self, rhs: &NonZero<Uint<LIMBS>>) -> (Uint<LIMBS>, Uint<LIMBS>)
Computes self / rhs, returns the quotient, remainder.
sourcepub fn rem(&self, rhs: &NonZero<Uint<LIMBS>>) -> Uint<LIMBS>
pub fn rem(&self, rhs: &NonZero<Uint<LIMBS>>) -> Uint<LIMBS>
Computes self % rhs, returns the remainder.
sourcepub fn wrapping_div(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
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
.
sourcepub fn checked_div(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>
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
sourcepub fn wrapping_rem(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
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
.
sourcepub fn checked_rem(&self, rhs: &Uint<LIMBS>) -> CtOption<Uint<LIMBS>>
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
sourcepub fn inv_mod2k_vartime(&self, k: usize) -> Uint<LIMBS>
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
sourcepub fn inv_mod2k(&self, k: usize) -> Uint<LIMBS>
pub fn inv_mod2k(&self, k: usize) -> Uint<LIMBS>
Computes 1/self
mod 2^k
.
Conditions: self
< 2^k and self
must be odd
sourcepub fn inv_odd_mod_bounded(
&self,
modulus: &Uint<LIMBS>,
bits: usize,
modulus_bits: usize
) -> (Uint<LIMBS>, CtChoice)
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
.
sourcepub fn inv_odd_mod(&self, modulus: &Uint<LIMBS>) -> (Uint<LIMBS>, CtChoice)
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)
.
sourcepub fn inv_mod(&self, modulus: &Uint<LIMBS>) -> (Uint<LIMBS>, CtChoice)
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)
.
sourcepub fn mul<const HLIMBS: usize>(
&self,
rhs: &Uint<HLIMBS>
) -> <Uint<HLIMBS> as ConcatMixed<Uint<LIMBS>>>::MixedOutputwhere
Uint<HLIMBS>: ConcatMixed<Uint<LIMBS>>,
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.
sourcepub fn mul_wide<const HLIMBS: usize>(
&self,
rhs: &Uint<HLIMBS>
) -> (Uint<LIMBS>, Uint<HLIMBS>)
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
sourcepub fn saturating_mul<const HLIMBS: usize>(
&self,
rhs: &Uint<HLIMBS>
) -> Uint<LIMBS>
pub fn saturating_mul<const HLIMBS: usize>( &self, rhs: &Uint<HLIMBS> ) -> Uint<LIMBS>
Perform saturating multiplication, returning MAX
on overflow.
sourcepub fn wrapping_mul<const H: usize>(&self, rhs: &Uint<H>) -> Uint<LIMBS>
pub fn wrapping_mul<const H: usize>(&self, rhs: &Uint<H>) -> Uint<LIMBS>
Perform wrapping multiplication, discarding overflow.
sourcepub fn square(&self) -> <Uint<LIMBS> as Concat>::Outputwhere
Uint<LIMBS>: Concat,
pub fn square(&self) -> <Uint<LIMBS> as Concat>::Outputwhere Uint<LIMBS>: Concat,
Square self, returning a concatenated “wide” result.
sourcepub fn square_wide(&self) -> (Uint<LIMBS>, Uint<LIMBS>)
pub fn square_wide(&self) -> (Uint<LIMBS>, Uint<LIMBS>)
Square self, returning a “wide” result in two parts as (lo, hi).
sourcepub fn mul_mod_special(&self, rhs: &Uint<LIMBS>, c: Limb) -> Uint<LIMBS>
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.
sourcepub fn wrapping_neg(&self) -> Uint<LIMBS>
pub fn wrapping_neg(&self) -> Uint<LIMBS>
Perform wrapping negation.
sourcepub fn neg_mod(&self, p: &Uint<LIMBS>) -> Uint<LIMBS>
pub fn neg_mod(&self, p: &Uint<LIMBS>) -> Uint<LIMBS>
Computes -a mod p
in constant time.
Assumes self
is in [0, p)
.
sourcepub fn neg_mod_special(&self, c: Limb) -> Uint<LIMBS>
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
.
sourcepub fn resize<const T: usize>(&self) -> Uint<T>
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.
sourcepub fn shl_vartime(&self, n: usize) -> Uint<LIMBS>
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
.
sourcepub fn shl(&self, shift: usize) -> Uint<LIMBS>
pub fn shl(&self, shift: usize) -> Uint<LIMBS>
Computes self << n
.
Returns zero if n >= Self::BITS
.
sourcepub fn shr_vartime(&self, shift: usize) -> Uint<LIMBS>
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
.
sourcepub fn shr(&self, shift: usize) -> Uint<LIMBS>
pub fn shr(&self, shift: usize) -> Uint<LIMBS>
Computes self << n
.
Returns zero if n >= Self::BITS
.
sourcepub fn sqrt(&self) -> Uint<LIMBS>
👎Deprecated since 0.5.3: This functionality will be moved to sqrt_vartime
in a future release.
pub fn sqrt(&self) -> Uint<LIMBS>
sqrt_vartime
in a future release.See Self::sqrt_vartime
.
sourcepub fn sqrt_vartime(&self) -> Uint<LIMBS>
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
sourcepub fn wrapping_sqrt(&self) -> Uint<LIMBS>
👎Deprecated since 0.5.3: This functionality will be moved to wrapping_sqrt_vartime
in a future release.
pub fn wrapping_sqrt(&self) -> Uint<LIMBS>
wrapping_sqrt_vartime
in a future release.sourcepub fn wrapping_sqrt_vartime(&self) -> Uint<LIMBS>
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.
sourcepub 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.
pub fn checked_sqrt(&self) -> CtOption<Uint<LIMBS>>
checked_sqrt_vartime
in a future release.sourcepub fn checked_sqrt_vartime(&self) -> CtOption<Uint<LIMBS>>
pub fn checked_sqrt_vartime(&self) -> CtOption<Uint<LIMBS>>
Perform checked sqrt, returning a CtOption
which is_some
only if the √(self
)² == self
sourcepub fn sbb(&self, rhs: &Uint<LIMBS>, borrow: Limb) -> (Uint<LIMBS>, Limb)
pub fn sbb(&self, rhs: &Uint<LIMBS>, borrow: Limb) -> (Uint<LIMBS>, Limb)
Computes a - (b + borrow)
, returning the result along with the new borrow.
sourcepub fn saturating_sub(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
pub fn saturating_sub(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
Perform saturating subtraction, returning ZERO
on underflow.
sourcepub fn wrapping_sub(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
pub fn wrapping_sub(&self, rhs: &Uint<LIMBS>) -> Uint<LIMBS>
Perform wrapping subtraction, discarding underflow and wrapping around the boundary of the type.
sourcepub fn sub_mod(&self, rhs: &Uint<LIMBS>, p: &Uint<LIMBS>) -> Uint<LIMBS>
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)
.
sourcepub fn sub_mod_special(&self, rhs: &Uint<LIMBS>, c: Limb) -> Uint<LIMBS>
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)
.
pub const ZERO: Uint<LIMBS> = _
pub const ONE: Uint<LIMBS> = _
pub const MAX: Uint<LIMBS> = _
pub const BITS: usize = _
pub const BYTES: usize = _
pub const LIMBS: usize = LIMBS
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#49}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U64::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#52}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#52}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#54}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U128::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#57}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#57}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#59}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U256::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#62}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#62}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#64}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U384::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#67}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#67}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#69}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U512::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#72}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#72}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#74}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U640::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#77}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#77}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#79}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U768::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#82}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#82}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#84}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U896::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#87}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#87}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#89}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U1024::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#92}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#92}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#94}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U1280::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#97}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#97}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#99}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U1536::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#102}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#102}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#104}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U1792::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#107}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#107}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#109}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U2048::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#112}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#112}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#114}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U3072::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#117}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#117}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#119}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U3584::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#122}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#122}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#124}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U4096::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#127}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#127}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#129}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U4224::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#132}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#132}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#134}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U4352::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#137}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#137}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#139}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U6144::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#142}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#142}::split::{constant#1}>)
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.
sourcepub fn concat(
&self,
lo: &Uint<crypto_bigint::::uint::{impl#144}::concat::{constant#0}>
) -> Uint<crypto_bigint::::uint::U8192::{constant#0}>
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.
sourcepub fn split(
&self
) -> (Uint<crypto_bigint::::uint::{impl#147}::split::{constant#0}>, Uint<crypto_bigint::::uint::{impl#147}::split::{constant#1}>)
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.
Trait Implementations§
source§impl ConditionallySelectable for BigInt
impl ConditionallySelectable for BigInt
source§impl Ord for BigInt
impl Ord for BigInt
source§impl PartialEq<BigInt> for BigInt
impl PartialEq<BigInt> for BigInt
source§impl PartialOrd<BigInt> for BigInt
impl PartialOrd<BigInt> for BigInt
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for BigInt
impl Eq for BigInt
impl StructuralEq for BigInt
impl StructuralPartialEq for BigInt
Auto Trait Implementations§
impl RefUnwindSafe for BigInt
impl Send for BigInt
impl Sync for BigInt
impl Unpin for BigInt
impl UnwindSafe for BigInt
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.