pub struct BigInt { /* private fields */ }Expand description
Big integer
Wraps underlying BigInt implementation (either GMP bindings or num-bigint), exposes only very limited API that allows easily switching between implementations.
Set of traits implemented on BigInt remains the same regardless of underlying implementation.
Trait Implementations§
Source§impl AddAssign<&BigInt> for BigInt
impl AddAssign<&BigInt> for BigInt
Source§fn add_assign(&mut self, rhs: &BigInt)
fn add_assign(&mut self, rhs: &BigInt)
Performs the
+= operation. Read moreSource§impl AddAssign<u64> for BigInt
impl AddAssign<u64> for BigInt
Source§fn add_assign(&mut self, rhs: u64)
fn add_assign(&mut self, rhs: u64)
Performs the
+= operation. Read moreSource§impl AddAssign for BigInt
impl AddAssign for BigInt
Source§fn add_assign(&mut self, rhs: BigInt)
fn add_assign(&mut self, rhs: BigInt)
Performs the
+= operation. Read moreSource§impl BitAndAssign<&BigInt> for BigInt
impl BitAndAssign<&BigInt> for BigInt
Source§fn bitand_assign(&mut self, rhs: &BigInt)
fn bitand_assign(&mut self, rhs: &BigInt)
Performs the
&= operation. Read moreSource§impl BitAndAssign for BigInt
impl BitAndAssign for BigInt
Source§fn bitand_assign(&mut self, rhs: BigInt)
fn bitand_assign(&mut self, rhs: BigInt)
Performs the
&= operation. Read moreSource§impl BitManipulation for BigInt
impl BitManipulation for BigInt
Source§impl BitOrAssign<&BigInt> for BigInt
impl BitOrAssign<&BigInt> for BigInt
Source§fn bitor_assign(&mut self, rhs: &BigInt)
fn bitor_assign(&mut self, rhs: &BigInt)
Performs the
|= operation. Read moreSource§impl BitOrAssign for BigInt
impl BitOrAssign for BigInt
Source§fn bitor_assign(&mut self, rhs: BigInt)
fn bitor_assign(&mut self, rhs: BigInt)
Performs the
|= operation. Read moreSource§impl BitXorAssign<&BigInt> for BigInt
impl BitXorAssign<&BigInt> for BigInt
Source§fn bitxor_assign(&mut self, rhs: &BigInt)
fn bitxor_assign(&mut self, rhs: &BigInt)
Performs the
^= operation. Read moreSource§impl BitXorAssign for BigInt
impl BitXorAssign for BigInt
Source§fn bitxor_assign(&mut self, rhs: BigInt)
fn bitxor_assign(&mut self, rhs: BigInt)
Performs the
^= operation. Read moreSource§impl<H: Digest + Clone> Commitment<BigInt> for HashCommitment<H>
impl<H: Digest + Clone> Commitment<BigInt> for HashCommitment<H>
Source§impl ConvertFrom<BigInt> for u64
impl ConvertFrom<BigInt> for u64
Source§impl Converter for BigInt
impl Converter for BigInt
Source§fn from_bytes(bytes: &[u8]) -> Self
fn from_bytes(bytes: &[u8]) -> Self
Constructs BigInt from its byte representation Read more
Source§fn to_str_radix(&self, radix: u8) -> String
fn to_str_radix(&self, radix: u8) -> String
Converts BigInt to radix representation. Read more
Source§fn from_str_radix(str: &str, radix: u8) -> Result<Self, ParseBigIntError>
fn from_str_radix(str: &str, radix: u8) -> Result<Self, ParseBigIntError>
Parses given radix string. Read more
Source§fn to_bytes_array<const N: usize>(&self) -> Option<[u8; N]>
fn to_bytes_array<const N: usize>(&self) -> Option<[u8; N]>
Returns bytes representation of the number in an array with length chosen by the user
if the array is larger than the bytes it pads it with zeros in the most significant bytes
If the array is too small for the integer it returns None. Read more
Source§impl<'de> Deserialize<'de> for BigInt
impl<'de> Deserialize<'de> for BigInt
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl DivAssign<&BigInt> for BigInt
impl DivAssign<&BigInt> for BigInt
Source§fn div_assign(&mut self, rhs: &BigInt)
fn div_assign(&mut self, rhs: &BigInt)
Performs the
/= operation. Read moreSource§impl DivAssign<u64> for BigInt
impl DivAssign<u64> for BigInt
Source§fn div_assign(&mut self, rhs: u64)
fn div_assign(&mut self, rhs: u64)
Performs the
/= operation. Read moreSource§impl DivAssign for BigInt
impl DivAssign for BigInt
Source§fn div_assign(&mut self, rhs: BigInt)
fn div_assign(&mut self, rhs: BigInt)
Performs the
/= operation. Read moreSource§impl Integer for BigInt
impl Integer for BigInt
Source§fn gcd_lcm(&self, other: &Self) -> (Self, Self)
fn gcd_lcm(&self, other: &Self) -> (Self, Self)
Greatest Common Divisor (GCD) and
Lowest Common Multiple (LCM) together. Read more
Source§fn divides(&self, other: &Self) -> bool
fn divides(&self, other: &Self) -> bool
👎Deprecated: Please use is_multiple_of instead
Deprecated, use
is_multiple_of instead.Source§fn is_multiple_of(&self, other: &Self) -> bool
fn is_multiple_of(&self, other: &Self) -> bool
Source§fn div_rem(&self, other: &Self) -> (Self, Self)
fn div_rem(&self, other: &Self) -> (Self, Self)
Simultaneous truncated integer division and modulus.
Returns
(quotient, remainder). Read moreSource§fn div_mod_floor(&self, other: &Self) -> (Self, Self)
fn div_mod_floor(&self, other: &Self) -> (Self, Self)
Simultaneous floored integer division and modulus.
Returns
(quotient, remainder). Read moreSource§fn next_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
fn next_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
Rounds up to nearest multiple of argument. Read more
Source§fn prev_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
fn prev_multiple_of(&self, other: &Self) -> Selfwhere
Self: Clone,
Rounds down to nearest multiple of argument. Read more
Source§fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>where
Self: Clone,
fn extended_gcd(&self, other: &Self) -> ExtendedGcd<Self>where
Self: Clone,
Greatest common divisor and Bézout coefficients. Read more
Source§impl Modulo for BigInt
impl Modulo for BigInt
Source§impl MulAssign<&BigInt> for BigInt
impl MulAssign<&BigInt> for BigInt
Source§fn mul_assign(&mut self, rhs: &BigInt)
fn mul_assign(&mut self, rhs: &BigInt)
Performs the
*= operation. Read moreSource§impl MulAssign<u64> for BigInt
impl MulAssign<u64> for BigInt
Source§fn mul_assign(&mut self, rhs: u64)
fn mul_assign(&mut self, rhs: u64)
Performs the
*= operation. Read moreSource§impl MulAssign for BigInt
impl MulAssign for BigInt
Source§fn mul_assign(&mut self, rhs: BigInt)
fn mul_assign(&mut self, rhs: BigInt)
Performs the
*= operation. Read moreSource§impl Num for BigInt
impl Num for BigInt
type FromStrRadixErr = ParseBigIntError
Source§fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
fn from_str_radix(str: &str, radix: u32) -> Result<Self, Self::FromStrRadixErr>
Convert from a string and radix (typically
2..=36). Read moreSource§impl NumberTests for BigInt
impl NumberTests for BigInt
Source§impl Ord for BigInt
impl Ord for BigInt
Source§impl PartialOrd for BigInt
impl PartialOrd for BigInt
Source§impl Primes for BigInt
impl Primes for BigInt
Source§fn next_prime(&self) -> BigInt
fn next_prime(&self) -> BigInt
Finds next prime number using probabilistic algorithms
Source§impl RemAssign<&BigInt> for BigInt
impl RemAssign<&BigInt> for BigInt
Source§fn rem_assign(&mut self, rhs: &BigInt)
fn rem_assign(&mut self, rhs: &BigInt)
Performs the
%= operation. Read moreSource§impl RemAssign<u64> for BigInt
impl RemAssign<u64> for BigInt
Source§fn rem_assign(&mut self, rhs: u64)
fn rem_assign(&mut self, rhs: u64)
Performs the
%= operation. Read moreSource§impl RemAssign for BigInt
impl RemAssign for BigInt
Source§fn rem_assign(&mut self, rhs: BigInt)
fn rem_assign(&mut self, rhs: BigInt)
Performs the
%= operation. Read moreSource§impl Roots for BigInt
impl Roots for BigInt
Source§impl Samplable for BigInt
impl Samplable for BigInt
Source§fn sample_below(upper: &Self) -> Self
fn sample_below(upper: &Self) -> Self
Generates random number within
[0; upper) range Read moreSource§fn sample_range(lower: &Self, upper: &Self) -> Self
fn sample_range(lower: &Self, upper: &Self) -> Self
Generates random number within
[lower; upper) range Read moreSource§fn strict_sample_range(lower: &Self, upper: &Self) -> Self
fn strict_sample_range(lower: &Self, upper: &Self) -> Self
Generates random number within
(lower; upper) range Read moreSource§fn strict_sample(bit_size: usize) -> Self
fn strict_sample(bit_size: usize) -> Self
Generates number within
[2^(bit_size-1); 2^bit_size) rangeSource§impl ShlAssign<usize> for BigInt
impl ShlAssign<usize> for BigInt
Source§fn shl_assign(&mut self, rhs: usize)
fn shl_assign(&mut self, rhs: usize)
Performs the
<<= operation. Read moreSource§impl ShrAssign<usize> for BigInt
impl ShrAssign<usize> for BigInt
Source§fn shr_assign(&mut self, rhs: usize)
fn shr_assign(&mut self, rhs: usize)
Performs the
>>= operation. Read moreSource§impl SubAssign<&BigInt> for BigInt
impl SubAssign<&BigInt> for BigInt
Source§fn sub_assign(&mut self, rhs: &BigInt)
fn sub_assign(&mut self, rhs: &BigInt)
Performs the
-= operation. Read moreSource§impl SubAssign<u64> for BigInt
impl SubAssign<u64> for BigInt
Source§fn sub_assign(&mut self, rhs: u64)
fn sub_assign(&mut self, rhs: u64)
Performs the
-= operation. Read moreSource§impl SubAssign for BigInt
impl SubAssign for BigInt
Source§fn sub_assign(&mut self, rhs: BigInt)
fn sub_assign(&mut self, rhs: BigInt)
Performs the
-= operation. Read moreSource§impl ZeroizeBN for BigInt
impl ZeroizeBN for BigInt
Source§fn zeroize_bn(&mut self)
fn zeroize_bn(&mut self)
👎Deprecated since 0.6.0: BigInt now implements zeroize::Zeroize trait, you should use it instead
impl Eq for BigInt
impl StructuralPartialEq for BigInt
Auto Trait Implementations§
impl Freeze for BigInt
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
Mutably borrows from an owned value. Read more