Struct Uint

Source
pub struct Uint { /* private fields */ }
Available on crate feature bigint only.
Expand description

Fixed-precision heap-allocated big unsigned integer.

Alternative to the stack-allocated Uint but with a fixed precision chosen at runtime instead of compile time.

Unlike many other heap-allocated big integer libraries, this type is not arbitrary precision and will wrap at its fixed-precision rather than automatically growing.

Implementations§

Source§

impl BoxedUint

Source

pub fn adc(&self, rhs: &BoxedUint, carry: Limb) -> (BoxedUint, Limb)

👎Deprecated since 0.7.0: please use carrying_add instead

Computes self + rhs + carry, returning the result along with the new carry.

Source

pub fn carrying_add(&self, rhs: &BoxedUint, carry: Limb) -> (BoxedUint, Limb)

Computes self + rhs + carry, returning the result along with the new carry.

Source

pub fn adc_assign(&mut self, rhs: impl AsRef<[Limb]>, carry: Limb) -> Limb

👎Deprecated since 0.7.0: please use carrying_add_assign instead

Computes a + b + carry in-place, returning the new carry.

Panics if rhs has a larger precision than self.

Source

pub fn carrying_add_assign( &mut self, rhs: impl AsRef<[Limb]>, carry: Limb, ) -> Limb

Computes a + b + carry in-place, returning the new carry.

Panics if rhs has a larger precision than self.

Source

pub fn wrapping_add(&self, rhs: &BoxedUint) -> BoxedUint

Perform wrapping addition, discarding overflow.

Source§

impl BoxedUint

Source

pub fn add_mod(&self, rhs: &BoxedUint, p: &BoxedUint) -> BoxedUint

Computes self + rhs mod p.

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

Source

pub fn add_mod_assign(&mut self, rhs: &BoxedUint, p: &BoxedUint)

Computes self + rhs mod p and writes the result in self.

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

Source

pub fn double_mod(&self, p: &BoxedUint) -> BoxedUint

Computes self + self mod p.

Assumes self as unbounded integer is < p.

Source§

impl BoxedUint

Source

pub fn bitand(&self, rhs: &BoxedUint) -> BoxedUint

Computes bitwise a & b.

Source

pub fn bitand_limb(&self, rhs: Limb) -> BoxedUint

Perform bitwise AND between self and the given Limb, performing the AND operation on every limb of self.

Source

pub fn wrapping_and(&self, rhs: &BoxedUint) -> BoxedUint

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: &BoxedUint) -> CtOption<BoxedUint>

Perform checked bitwise AND, returning a CtOption which is_some always

Source§

impl BoxedUint

Source

pub fn not(&self) -> BoxedUint

Computes bitwise !a.

Source§

impl BoxedUint

Source

pub fn bitor(&self, rhs: &BoxedUint) -> BoxedUint

Computes bitwise a & b.

Source

pub fn wrapping_or(&self, rhs: &BoxedUint) -> BoxedUint

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: &BoxedUint) -> CtOption<BoxedUint>

Perform checked bitwise OR, returning a CtOption which is_some always

Source§

impl BoxedUint

Source

pub fn bitxor(&self, rhs: &BoxedUint) -> BoxedUint

Computes bitwise a ^ b.

Source

pub fn wrapping_xor(&self, rhs: &BoxedUint) -> BoxedUint

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: &BoxedUint) -> CtOption<BoxedUint>

Perform checked bitwise XOR, returning a CtOption which is_some always

Source§

impl BoxedUint

Source

pub fn bit(&self, index: u32) -> Choice

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

Source

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

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

§Remarks

This operation is variable time with respect to index only.

Source

pub fn bits(&self) -> u32

Calculate the number of bits needed to represent this number, i.e. the index of the highest set bit.

Use BoxedUint::bits_precision to get the total capacity of this integer.

Source

pub fn bits_vartime(&self) -> u32

Calculate the number of bits needed to represent this number in variable-time with respect to self.

Source

pub const fn leading_zeros(&self) -> u32

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

Source

pub fn bits_precision(&self) -> u32

Get the precision of this BoxedUint in bits.

Source

pub fn trailing_zeros(&self) -> u32

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

Source

pub fn trailing_ones(&self) -> u32

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

Source

pub fn trailing_zeros_vartime(&self) -> u32

Calculate the number of trailing zeros in the binary representation of this number in variable-time with respect to self.

Source

pub fn trailing_ones_vartime(&self) -> u32

Calculate the number of trailing ones in the binary representation of this number, variable time in self.

Source§

impl BoxedUint

Source

pub fn cmp_vartime(&self, rhs: &BoxedUint) -> Ordering

Returns the Ordering between self and rhs in variable time.

Source§

impl BoxedUint

Source

pub fn div_rem_limb_with_reciprocal( &self, reciprocal: &Reciprocal, ) -> (BoxedUint, 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>) -> (BoxedUint, Limb)

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

Source

pub fn rem_limb_with_reciprocal(&self, reciprocal: &Reciprocal) -> Limb

Computes self % rhs using a pre-made reciprocal.

Source

pub fn rem_limb(&self, rhs: NonZero<Limb>) -> Limb

Computes self % rhs.

Source

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

Computes self / rhs, returns the quotient, remainder.

Source

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

Computes self % rhs, returns the remainder.

Source

pub fn div_rem_vartime( &self, rhs: &NonZero<BoxedUint>, ) -> (BoxedUint, BoxedUint)

Computes self / rhs, returns the quotient, remainder.

Variable-time with respect to rhs

Source

pub fn rem_vartime(&self, rhs: &NonZero<BoxedUint>) -> BoxedUint

Computes self % rhs, returns the remainder.

Variable-time with respect to rhs.

Source

pub fn wrapping_div(&self, rhs: &NonZero<BoxedUint>) -> BoxedUint

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 wrapping_div_vartime(&self, rhs: &NonZero<BoxedUint>) -> BoxedUint

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

Source

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

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

Source§

impl BoxedUint

Source

pub fn from_be_slice( bytes: &[u8], bits_precision: u32, ) -> Result<BoxedUint, DecodeError>

Create a new BoxedUint from the provided big endian bytes.

The bits_precision argument represents the precision of the resulting integer, which is fixed as this type is not arbitrary-precision. The new BoxedUint will be created with bits_precision rounded up to a multiple of Limb::BITS.

If the length of bytes is larger than bits_precision (rounded up to a multiple of 8) this function will return DecodeError::InputSize. If the size of the decoded integer is larger than bits_precision, this function will return DecodeError::Precision.

Source

pub fn from_le_slice( bytes: &[u8], bits_precision: u32, ) -> Result<BoxedUint, DecodeError>

Create a new BoxedUint from the provided little endian bytes.

The bits_precision argument represents the precision of the resulting integer, which is fixed as this type is not arbitrary-precision. The new BoxedUint will be created with bits_precision rounded up to a multiple of Limb::BITS.

If the length of bytes is larger than bits_precision (rounded up to a multiple of 8) this function will return DecodeError::InputSize. If the size of the decoded integer is larger than bits_precision, this function will return DecodeError::Precision.

Source

pub fn to_be_bytes(&self) -> Box<[u8]>

Serialize this BoxedUint as big-endian.

Source

pub fn to_be_bytes_trimmed_vartime(&self) -> Box<[u8]>

Serialize this BoxedUint as big-endian without leading zeroes.

Source

pub fn to_le_bytes(&self) -> Box<[u8]>

Serialize this BoxedUint as little-endian.

Source

pub fn to_le_bytes_trimmed_vartime(&self) -> Box<[u8]>

Serialize this BoxedUint as little-endian without trailing zeroes.

Source

pub fn from_be_hex(hex: &str, bits_precision: u32) -> CtOption<BoxedUint>

Create a new BoxedUint from the provided big endian hex string.

Source

pub fn from_str_radix_vartime( src: &str, radix: u32, ) -> Result<BoxedUint, DecodeError>

Create a new BoxedUint from a big-endian string in a given base.

The string may begin with a + character, and may use underscore characters to separate digits.

If the input value contains non-digit characters or digits outside of the range 0..radix this function will return DecodeError::InvalidDigit. Panics if radix is not in the range from 2 to 36.

Source

pub fn from_str_radix_with_precision_vartime( src: &str, radix: u32, bits_precision: u32, ) -> Result<BoxedUint, DecodeError>

Create a new BoxedUint from a big-endian string in a given base, with a given precision.

The string may begin with a + character, and may use underscore characters to separate digits.

The bits_precision argument represents the precision of the resulting integer, which is fixed as this type is not arbitrary-precision. The new BoxedUint will be created with bits_precision rounded up to a multiple of Limb::BITS.

If the input value contains non-digit characters or digits outside of the range 0..radix this function will return DecodeError::InvalidDigit. If the length of bytes is larger than bits_precision (rounded up to a multiple of 8) this function will return DecodeError::InputSize. If the size of the decoded integer is larger than bits_precision, this function will return DecodeError::Precision. Panics if radix is not in the range from 2 to 36.

Source

pub fn to_string_radix_vartime(&self, radix: u32) -> String

Format a BoxedUint as a string in a given base.

Panics if radix is not in the range from 2 to 36.

Source§

impl BoxedUint

Source

pub fn inv_odd_mod(&self, modulus: &Odd<BoxedUint>) -> CtOption<BoxedUint>

👎Deprecated since 0.7.0: please use invert_odd_mod instead

Computes the multiplicative inverse of self mod modulus, where modulus is odd.

Source

pub fn invert_odd_mod(&self, modulus: &Odd<BoxedUint>) -> CtOption<BoxedUint>

Computes the multiplicative inverse of self mod modulus, where modulus is odd.

Source

pub fn inv_mod2k_vartime(&self, k: u32) -> (BoxedUint, Choice)

👎Deprecated since 0.7.0: please use invert_mod2k_vartime instead

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

If the inverse does not exist (k > 0 and self is even), returns Choice::FALSE as the second element of the tuple, otherwise returns Choice::TRUE.

Source

pub fn invert_mod2k_vartime(&self, k: u32) -> (BoxedUint, Choice)

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

If the inverse does not exist (k > 0 and self is even), returns Choice::FALSE as the second element of the tuple, otherwise returns Choice::TRUE.

Source

pub fn inv_mod2k(&self, k: u32) -> (BoxedUint, Choice)

👎Deprecated since 0.7.0: please use invert_mod2k instead

Computes 1/self mod 2^k.

If the inverse does not exist (k > 0 and self is even), returns Choice::FALSE as the second element of the tuple, otherwise returns Choice::TRUE.

Source

pub fn invert_mod2k(&self, k: u32) -> (BoxedUint, Choice)

Computes 1/self mod 2^k.

If the inverse does not exist (k > 0 and self is even), returns Choice::FALSE as the second element of the tuple, otherwise returns Choice::TRUE.

Source

pub fn inv_mod(&self, modulus: &BoxedUint) -> CtOption<BoxedUint>

👎Deprecated since 0.7.0: please use invert_mod instead

Computes the multiplicaitve inverse of self mod modulus

self and modulus must have the same number of limbs, or the function will panic

TODO: maybe some better documentation is needed

Source

pub fn invert_mod(&self, modulus: &BoxedUint) -> CtOption<BoxedUint>

Computes the multiplicaitve inverse of self mod modulus

self and modulus must have the same number of limbs, or the function will panic

TODO: maybe some better documentation is needed

Source§

impl BoxedUint

Source

pub fn mul(&self, rhs: &BoxedUint) -> BoxedUint

Multiply self by rhs.

Returns a widened output with a limb count equal to the sums of the input limb counts.

Source

pub fn wrapping_mul(&self, rhs: &BoxedUint) -> BoxedUint

Perform wrapping multiplication, wrapping to the width of self.

Source

pub fn square(&self) -> BoxedUint

Multiply self by itself.

Source§

impl BoxedUint

Source

pub fn mul_mod(&self, rhs: &BoxedUint, p: &BoxedUint) -> BoxedUint

Computes self * rhs mod p for odd p.

Panics if p is even.

Source

pub fn mul_mod_special(&self, rhs: &BoxedUint, c: Limb) -> BoxedUint

Computes self * rhs mod p 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§

impl BoxedUint

Source

pub fn wrapping_neg(&self) -> BoxedUint

Perform wrapping negation.

Source§

impl BoxedUint

Source

pub fn neg_mod(&self, p: &BoxedUint) -> BoxedUint

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

Source

pub fn neg_mod_special(&self, c: Limb) -> BoxedUint

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

Source§

impl BoxedUint

Source

pub fn shl(&self, shift: u32) -> BoxedUint

Computes self << shift.

Panics if shift >= Self::BITS.

Source

pub fn shl_assign(&mut self, shift: u32)

Computes self <<= shift.

Panics if shift >= Self::BITS.

Source

pub fn overflowing_shl(&self, shift: u32) -> (BoxedUint, Choice)

Computes self << shift.

Returns a zero and a truthy Choice if shift >= self.bits_precision(), or the result and a falsy Choice otherwise.

Source

pub fn overflowing_shl_assign(&mut self, shift: u32) -> Choice

Computes self <<= shift.

Returns a truthy Choice if shift >= self.bits_precision() or a falsy Choice otherwise.

Source

pub fn wrapping_shl(&self, shift: u32) -> BoxedUint

Computes self << shift in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.

Source

pub fn wrapping_shl_vartime(&self, shift: u32) -> BoxedUint

Computes self << shift in variable-time in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.

Source

pub fn shl_vartime(&self, shift: u32) -> Option<BoxedUint>

Computes self << shift. Returns None if shift >= self.bits_precision().

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

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

Source§

impl BoxedUint

Source

pub fn shr(&self, shift: u32) -> BoxedUint

Computes self >> shift.

Panics if shift >= Self::BITS.

Source

pub fn shr_assign(&mut self, shift: u32)

Computes self >>= shift.

Panics if shift >= Self::BITS.

Source

pub fn overflowing_shr(&self, shift: u32) -> (BoxedUint, Choice)

Computes self >> shift.

Returns a zero and a truthy Choice if shift >= self.bits_precision(), or the result and a falsy Choice otherwise.

Source

pub fn overflowing_shr_assign(&mut self, shift: u32) -> Choice

Computes self >>= shift.

Returns a truthy Choice if shift >= self.bits_precision() or a falsy Choice otherwise.

Source

pub fn wrapping_shr(&self, shift: u32) -> BoxedUint

Computes self >> shift in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.

Source

pub fn wrapping_shr_vartime(&self, shift: u32) -> BoxedUint

Computes self >> shift in variable-time in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.

Source

pub fn shr_vartime(&self, shift: u32) -> Option<BoxedUint>

Computes self >> shift. Returns None if shift >= self.bits_precision().

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

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

Source§

impl BoxedUint

Source

pub fn sqrt(&self) -> BoxedUint

Computes √(self) in constant time.

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

Source

pub fn sqrt_vartime(&self) -> BoxedUint

Computes √(self)

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

Source

pub fn wrapping_sqrt(&self) -> BoxedUint

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 wrapping_sqrt_vartime(&self) -> BoxedUint

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<BoxedUint>

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

Source

pub fn checked_sqrt_vartime(&self) -> CtOption<BoxedUint>

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

Source§

impl BoxedUint

Source

pub fn sbb(&self, rhs: &BoxedUint, borrow: Limb) -> (BoxedUint, Limb)

👎Deprecated since 0.7.0: please use borrowing_sub instead

Computes self - (rhs + borrow), returning the result along with the new borrow.

Source

pub fn borrowing_sub(&self, rhs: &BoxedUint, borrow: Limb) -> (BoxedUint, Limb)

Computes self - (rhs + borrow), returning the result along with the new borrow.

Source

pub fn sbb_assign(&mut self, rhs: impl AsRef<[Limb]>, borrow: Limb) -> Limb

👎Deprecated since 0.7.0: please use borrowing_sub_assign instead

Computes a - (b + borrow) in-place, returning the new borrow.

Panics if rhs has a larger precision than self.

Source

pub fn borrowing_sub_assign( &mut self, rhs: impl AsRef<[Limb]>, borrow: Limb, ) -> Limb

Computes a - (b + borrow) in-place, returning the new borrow.

Panics if rhs has a larger precision than self.

Source

pub fn wrapping_sub(&self, rhs: &BoxedUint) -> BoxedUint

Perform wrapping subtraction, discarding overflow.

Source§

impl BoxedUint

Source

pub fn sub_mod(&self, rhs: &BoxedUint, p: &BoxedUint) -> BoxedUint

Computes self - rhs mod p.

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

Source

pub fn sub_mod_special(&self, rhs: &BoxedUint, c: Limb) -> BoxedUint

Computes self - rhs mod p 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§

impl BoxedUint

Source

pub fn zero() -> BoxedUint

Get the value 0 represented as succinctly as possible.

Source

pub fn zero_with_precision(at_least_bits_precision: u32) -> BoxedUint

Get the value 0 with the given number of bits of precision.

at_least_bits_precision is rounded up to a multiple of Limb::BITS.

Source

pub fn one() -> BoxedUint

Get the value 1, represented as succinctly as possible.

Source

pub fn one_with_precision(at_least_bits_precision: u32) -> BoxedUint

Get the value 1 with the given number of bits of precision.

at_least_bits_precision is rounded up to a multiple of Limb::BITS.

Source

pub fn is_zero(&self) -> Choice

Is this BoxedUint equal to zero?

Source

pub fn is_nonzero(&self) -> Choice

Is this BoxedUint NOT equal to zero?

Source

pub fn is_one(&self) -> Choice

Is this BoxedUint equal to one?

Source

pub fn max(at_least_bits_precision: u32) -> BoxedUint

Get the maximum value for a BoxedUint created with at_least_bits_precision precision bits requested.

That is, returns the value 2^self.bits_precision() - 1.

Source

pub fn from_words(words: impl IntoIterator<Item = u64>) -> BoxedUint

Create a BoxedUint from an array of Words (i.e. word-sized unsigned integers).

Source

pub fn to_words(&self) -> Box<[u64]>

Create a boxed slice of Words (i.e. word-sized unsigned integers) from a BoxedUint.

Source

pub fn as_words(&self) -> &[u64]

Borrow the inner limbs as a slice of Words.

Source

pub fn as_mut_words(&mut self) -> &mut [u64]

Borrow the inner limbs as a mutable slice of Words.

Source

pub fn as_words_mut(&mut self) -> &mut [u64]

👎Deprecated since 0.7.0: please use as_mut_words instead

Borrow the inner limbs as a mutable slice of Words.

Source

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

Borrow the limbs of this BoxedUint.

Source

pub fn as_mut_limbs(&mut self) -> &mut [Limb]

Borrow the limbs of this BoxedUint mutably.

Source

pub fn as_limbs_mut(&mut self) -> &mut [Limb]

👎Deprecated since 0.7.0: please use as_mut_limbs instead

Borrow the limbs of this BoxedUint mutably.

Source

pub fn to_limbs(&self) -> Box<[Limb]>

Convert this BoxedUint into its inner limbs.

Source

pub fn into_limbs(self) -> Box<[Limb]>

Convert this BoxedUint into its inner limbs.

Source

pub fn nlimbs(&self) -> usize

Get the number of limbs in this BoxedUint.

Source

pub fn to_odd(&self) -> CtOption<Odd<BoxedUint>>

Convert into an Odd.

Source

pub fn widen(&self, at_least_bits_precision: u32) -> BoxedUint

👎Deprecated since 0.7.0: please use resize instead

Widen this type’s precision to the given number of bits.

Panics if at_least_bits_precision is smaller than the current precision.

Source

pub fn shorten(&self, at_least_bits_precision: u32) -> BoxedUint

👎Deprecated since 0.7.0: please use resize instead

Shortens this type’s precision to the given number of bits.

Panics if at_least_bits_precision is larger than the current precision.

Trait Implementations§

Source§

impl Add<&BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &BoxedUint) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<&BoxedUint> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &BoxedUint) -> BoxedUint

Performs the + operation. Read more
Source§

impl<const LIMBS: usize> Add<&Uint<LIMBS>> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Uint<LIMBS>) -> BoxedUint

Performs the + operation. Read more
Source§

impl<const LIMBS: usize> Add<&Uint<LIMBS>> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Uint<LIMBS>) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: BoxedUint) -> BoxedUint

Performs the + operation. Read more
Source§

impl<const LIMBS: usize> Add<Uint<LIMBS>> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Uint<LIMBS>) -> BoxedUint

Performs the + operation. Read more
Source§

impl<const LIMBS: usize> Add<Uint<LIMBS>> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Uint<LIMBS>) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u128> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u128) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u128> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u128) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u16> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u16) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u16> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u16) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u32> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u32) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u32> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u32) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u64> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u64) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u64> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u64) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u8> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u8) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add<u8> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u8) -> BoxedUint

Performs the + operation. Read more
Source§

impl Add for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: BoxedUint) -> BoxedUint

Performs the + operation. Read more
Source§

impl AddAssign<&BoxedUint> for BoxedUint

Source§

fn add_assign(&mut self, rhs: &BoxedUint)

Performs the += operation. Read more
Source§

impl<const LIMBS: usize> AddAssign<&Uint<LIMBS>> for BoxedUint

Source§

fn add_assign(&mut self, rhs: &Uint<LIMBS>)

Performs the += operation. Read more
Source§

impl<const LIMBS: usize> AddAssign<Uint<LIMBS>> for BoxedUint

Source§

fn add_assign(&mut self, rhs: Uint<LIMBS>)

Performs the += operation. Read more
Source§

impl AddAssign<u128> for BoxedUint

Source§

fn add_assign(&mut self, rhs: u128)

Performs the += operation. Read more
Source§

impl AddAssign<u16> for BoxedUint

Source§

fn add_assign(&mut self, rhs: u16)

Performs the += operation. Read more
Source§

impl AddAssign<u32> for BoxedUint

Source§

fn add_assign(&mut self, rhs: u32)

Performs the += operation. Read more
Source§

impl AddAssign<u64> for BoxedUint

Source§

fn add_assign(&mut self, rhs: u64)

Performs the += operation. Read more
Source§

impl AddAssign<u8> for BoxedUint

Source§

fn add_assign(&mut self, rhs: u8)

Performs the += operation. Read more
Source§

impl AddAssign for BoxedUint

Source§

fn add_assign(&mut self, rhs: BoxedUint)

Performs the += operation. Read more
Source§

impl AddMod for BoxedUint

Source§

type Output = BoxedUint

Output type.
Source§

fn add_mod(&self, rhs: &BoxedUint, p: &BoxedUint) -> BoxedUint

Compute self + rhs mod p. Read more
Source§

impl AsMut<[Limb]> for BoxedUint

Source§

fn as_mut(&mut self) -> &mut [Limb]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsMut<[u64]> for BoxedUint

Source§

fn as_mut(&mut self) -> &mut [u64]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsMut<UintRef> for BoxedUint

Source§

fn as_mut(&mut self) -> &mut UintRef

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl AsRef<[Limb]> for BoxedUint

Source§

fn as_ref(&self) -> &[Limb]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<[u64]> for BoxedUint

Source§

fn as_ref(&self) -> &[u64]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl AsRef<UintRef> for BoxedUint

Source§

fn as_ref(&self) -> &UintRef

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Binary for BoxedUint

Source§

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

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

impl BitAnd<&BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &BoxedUint) -> BoxedUint

Performs the & operation. Read more
Source§

impl BitAnd<&BoxedUint> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: &BoxedUint) -> BoxedUint

Performs the & operation. Read more
Source§

impl BitAnd<BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: BoxedUint) -> BoxedUint

Performs the & operation. Read more
Source§

impl BitAnd for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: BoxedUint) -> BoxedUint

Performs the & operation. Read more
Source§

impl BitAndAssign<&BoxedUint> for BoxedUint

Source§

fn bitand_assign(&mut self, other: &BoxedUint)

Performs the &= operation. Read more
Source§

impl BitAndAssign for BoxedUint

Source§

fn bitand_assign(&mut self, other: BoxedUint)

Performs the &= operation. Read more
Source§

impl BitOps for BoxedUint

Source§

fn bits_precision(&self) -> u32

Precision of this integer in bits.
Source§

fn bytes_precision(&self) -> usize

Precision of this integer in bytes.
Source§

fn leading_zeros(&self) -> u32

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

fn bits(&self) -> u32

Calculate the number of bits required to represent a given number.
Source§

fn bit(&self, index: u32) -> Choice

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

fn set_bit(&mut self, index: u32, bit_value: Choice)

Sets the bit at index to 0 or 1 depending on the value of bit_value.
Source§

fn trailing_zeros(&self) -> u32

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

fn trailing_ones(&self) -> u32

Calculate the number of trailing ones in the binary representation of this number.
Source§

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

Returns true if the bit at position index is set, false otherwise. Read more
Source§

fn bits_vartime(&self) -> u32

Calculate the number of bits required to represent a given number in variable-time with respect to self.
Source§

fn set_bit_vartime(&mut self, index: u32, bit_value: bool)

Sets the bit at index to 0 or 1 depending on the value of bit_value, variable time in self.
Source§

fn trailing_zeros_vartime(&self) -> u32

Calculate the number of trailing zeros in the binary representation of this number in variable-time with respect to self.
Source§

fn trailing_ones_vartime(&self) -> u32

Calculate the number of trailing ones in the binary representation of this number, variable time in self.
Source§

fn log2_bits(&self) -> u32

floor(log2(self.bits_precision())).
Source§

fn leading_zeros_vartime(&self) -> u32

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

impl BitOr<&BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &BoxedUint) -> BoxedUint

Performs the | operation. Read more
Source§

impl BitOr<&BoxedUint> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: &BoxedUint) -> BoxedUint

Performs the | operation. Read more
Source§

impl BitOr<BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: BoxedUint) -> BoxedUint

Performs the | operation. Read more
Source§

impl BitOr for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: BoxedUint) -> BoxedUint

Performs the | operation. Read more
Source§

impl BitOrAssign<&BoxedUint> for BoxedUint

Source§

fn bitor_assign(&mut self, other: &BoxedUint)

Performs the |= operation. Read more
Source§

impl BitOrAssign for BoxedUint

Source§

fn bitor_assign(&mut self, other: BoxedUint)

Performs the |= operation. Read more
Source§

impl BitXor<&BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &BoxedUint) -> BoxedUint

Performs the ^ operation. Read more
Source§

impl BitXor<&BoxedUint> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: &BoxedUint) -> BoxedUint

Performs the ^ operation. Read more
Source§

impl BitXor<BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: BoxedUint) -> BoxedUint

Performs the ^ operation. Read more
Source§

impl BitXor for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: BoxedUint) -> BoxedUint

Performs the ^ operation. Read more
Source§

impl BitXorAssign<&BoxedUint> for BoxedUint

Source§

fn bitxor_assign(&mut self, other: &BoxedUint)

Performs the ^= operation. Read more
Source§

impl BitXorAssign for BoxedUint

Source§

fn bitxor_assign(&mut self, other: BoxedUint)

Performs the ^= operation. Read more
Source§

impl CheckedAdd for BoxedUint

Source§

fn checked_add(&self, rhs: &BoxedUint) -> CtOption<BoxedUint>

Perform checked addition, returning a CtOption which is_some only if the operation did not overflow.
Source§

impl CheckedDiv for BoxedUint

Source§

fn checked_div(&self, rhs: &BoxedUint) -> CtOption<BoxedUint>

Perform checked division, returning a CtOption which is_some only if the divisor is non-zero.
Source§

impl CheckedMul for BoxedUint

Source§

fn checked_mul(&self, rhs: &BoxedUint) -> CtOption<BoxedUint>

Perform checked multiplication, returning a CtOption which is_some only if the operation did not overflow.
Source§

impl CheckedSub for BoxedUint

Source§

fn checked_sub(&self, rhs: &BoxedUint) -> CtOption<BoxedUint>

Perform checked subtraction, returning a CtOption which is_some only if the operation did not underflow.
Source§

impl Clone for BoxedUint

Source§

fn clone(&self) -> BoxedUint

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 ConcatenatingMul<&BoxedUint> for BoxedUint

Source§

type Output = BoxedUint

Output of the widening multiplication.
Source§

fn concatenating_mul(&self, rhs: &BoxedUint) -> BoxedUint

Perform widening multiplication.
Source§

impl ConcatenatingMul for BoxedUint

Source§

type Output = BoxedUint

Output of the widening multiplication.
Source§

fn concatenating_mul(&self, rhs: BoxedUint) -> BoxedUint

Perform widening multiplication.
Source§

impl ConditionallyNegatable for BoxedUint

Source§

fn conditional_negate(&mut self, choice: Choice)

Negate self if choice == Choice(1); otherwise, leave it unchanged. Read more
Source§

impl ConstantTimeEq for BoxedUint

Source§

fn ct_eq(&self, other: &BoxedUint) -> Choice

Determine if two items are equal. Read more
Source§

fn ct_ne(&self, other: &Self) -> Choice

Determine if two items are NOT equal. Read more
Source§

impl ConstantTimeGreater for BoxedUint

Source§

fn ct_gt(&self, other: &BoxedUint) -> Choice

Determine whether self > other. Read more
Source§

impl ConstantTimeLess for BoxedUint

Source§

fn ct_lt(&self, other: &BoxedUint) -> Choice

Determine whether self < other. Read more
Source§

impl ConstantTimeSelect for BoxedUint

NOTE: can’t impl subtle’s ConditionallySelectable trait due to its Copy bound

Source§

fn ct_select(a: &BoxedUint, b: &BoxedUint, choice: Choice) -> BoxedUint

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

fn ct_assign(&mut self, other: &BoxedUint, choice: Choice)

Conditionally assign other to self, according to choice.
Source§

fn ct_swap(a: &mut BoxedUint, b: &mut BoxedUint, choice: Choice)

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

impl Debug for BoxedUint

Source§

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

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

impl Default for BoxedUint

Source§

fn default() -> BoxedUint

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

impl Display for BoxedUint

Source§

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

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

impl Div<&NonZero<BoxedUint>> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the / operator.
Source§

fn div( self, rhs: &NonZero<BoxedUint>, ) -> <&BoxedUint as Div<&NonZero<BoxedUint>>>::Output

Performs the / operation. Read more
Source§

impl Div<&NonZero<BoxedUint>> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the / operator.
Source§

fn div( self, rhs: &NonZero<BoxedUint>, ) -> <BoxedUint as Div<&NonZero<BoxedUint>>>::Output

Performs the / operation. Read more
Source§

impl Div<NonZero<BoxedUint>> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the / operator.
Source§

fn div( self, rhs: NonZero<BoxedUint>, ) -> <&BoxedUint as Div<NonZero<BoxedUint>>>::Output

Performs the / operation. Read more
Source§

impl Div<NonZero<BoxedUint>> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the / operator.
Source§

fn div( self, rhs: NonZero<BoxedUint>, ) -> <BoxedUint as Div<NonZero<BoxedUint>>>::Output

Performs the / operation. Read more
Source§

impl DivAssign<&NonZero<BoxedUint>> for BoxedUint

Source§

fn div_assign(&mut self, rhs: &NonZero<BoxedUint>)

Performs the /= operation. Read more
Source§

impl DivAssign<NonZero<BoxedUint>> for BoxedUint

Source§

fn div_assign(&mut self, rhs: NonZero<BoxedUint>)

Performs the /= operation. Read more
Source§

impl DivRemLimb for BoxedUint

Source§

fn div_rem_limb_with_reciprocal( &self, reciprocal: &Reciprocal, ) -> (BoxedUint, Limb)

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

fn div_rem_limb(&self, rhs: NonZero<Limb>) -> (Self, Limb)

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

impl DivVartime for BoxedUint

Source§

fn div_vartime(&self, rhs: &NonZero<BoxedUint>) -> BoxedUint

Computes self / rhs in variable time.
Source§

impl From<&[Limb]> for BoxedUint

Source§

fn from(limbs: &[Limb]) -> BoxedUint

Converts to this type from the input type.
Source§

impl<const LIMBS: usize> From<&Odd<Uint<LIMBS>>> for BoxedUint

Source§

fn from(uint: &Odd<Uint<LIMBS>>) -> BoxedUint

Converts to this type from the input type.
Source§

impl<const LIMBS: usize> From<&Uint<LIMBS>> for BoxedUint

Source§

fn from(uint: &Uint<LIMBS>) -> BoxedUint

Converts to this type from the input type.
Source§

impl From<Box<[Limb]>> for BoxedUint

Source§

fn from(limbs: Box<[Limb]>) -> BoxedUint

Converts to this type from the input type.
Source§

impl From<Limb> for BoxedUint

Source§

fn from(limb: Limb) -> BoxedUint

Converts to this type from the input type.
Source§

impl<const LIMBS: usize> From<Odd<Uint<LIMBS>>> for BoxedUint

Source§

fn from(uint: Odd<Uint<LIMBS>>) -> BoxedUint

Converts to this type from the input type.
Source§

impl<const LIMBS: usize> From<Uint<LIMBS>> for BoxedUint

Source§

fn from(uint: Uint<LIMBS>) -> BoxedUint

Converts to this type from the input type.
Source§

impl From<Vec<Limb>> for BoxedUint

Source§

fn from(limbs: Vec<Limb>) -> BoxedUint

Converts to this type from the input type.
Source§

impl From<Vec<u64>> for BoxedUint

Source§

fn from(words: Vec<u64>) -> BoxedUint

Converts to this type from the input type.
Source§

impl From<u128> for BoxedUint

Source§

fn from(n: u128) -> BoxedUint

Converts to this type from the input type.
Source§

impl From<u16> for BoxedUint

Source§

fn from(n: u16) -> BoxedUint

Converts to this type from the input type.
Source§

impl From<u32> for BoxedUint

Source§

fn from(n: u32) -> BoxedUint

Converts to this type from the input type.
Source§

impl From<u64> for BoxedUint

Source§

fn from(n: u64) -> BoxedUint

Converts to this type from the input type.
Source§

impl From<u8> for BoxedUint

Source§

fn from(n: u8) -> BoxedUint

Converts to this type from the input type.
Source§

impl Gcd<BoxedUint> for Odd<BoxedUint>

Source§

type Output = BoxedUint

Output type.
Source§

fn gcd(&self, rhs: &BoxedUint) -> BoxedUint

Compute the greatest common divisor of self and rhs.
Source§

fn gcd_vartime( &self, rhs: &BoxedUint, ) -> <Odd<BoxedUint> as Gcd<BoxedUint>>::Output

Compute the greatest common divisor of self and rhs in variable time.
Source§

impl Gcd for BoxedUint

Source§

fn gcd(&self, rhs: &BoxedUint) -> BoxedUint

Compute the greatest common divisor (GCD) of this number and another.

Source§

type Output = BoxedUint

Output type.
Source§

fn gcd_vartime(&self, rhs: &BoxedUint) -> <BoxedUint as Gcd>::Output

Compute the greatest common divisor of self and rhs in variable time.
Source§

impl Hash for BoxedUint

Source§

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

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 Integer for BoxedUint

Source§

type Monty = BoxedMontyForm

The corresponding Montgomery representation, optimized for the performance of modular operations at the price of a conversion overhead.
Source§

fn one() -> BoxedUint

The value 1.
Source§

fn from_limb_like(limb: Limb, other: &BoxedUint) -> BoxedUint

Returns an integer with the first limb set to limb, and the same precision as other.
Source§

fn nlimbs(&self) -> usize

Number of limbs in this integer.
Source§

fn one_like(other: &Self) -> Self

The value 1 with the same precision as other.
Source§

fn is_odd(&self) -> Choice

Is this integer value an odd number? Read more
Source§

fn is_even(&self) -> Choice

Is this integer value an even number? Read more
Source§

impl InvertMod for BoxedUint

Source§

type Output = BoxedUint

Output type.
Source§

fn invert_mod(&self, modulus: &BoxedUint) -> CtOption<BoxedUint>

Compute 1 / self mod p.
Source§

impl LowerHex for BoxedUint

Source§

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

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

impl Mul<&BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &BoxedUint) -> <&BoxedUint as Mul<&BoxedUint>>::Output

Performs the * operation. Read more
Source§

impl Mul<&BoxedUint> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &BoxedUint) -> BoxedUint

Performs the * operation. Read more
Source§

impl Mul<BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: BoxedUint) -> <&BoxedUint as Mul<BoxedUint>>::Output

Performs the * operation. Read more
Source§

impl Mul for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: BoxedUint) -> BoxedUint

Performs the * operation. Read more
Source§

impl MulAssign<&BoxedUint> for BoxedUint

Source§

fn mul_assign(&mut self, rhs: &BoxedUint)

Performs the *= operation. Read more
Source§

impl MulAssign for BoxedUint

Source§

fn mul_assign(&mut self, rhs: BoxedUint)

Performs the *= operation. Read more
Source§

impl MulMod for BoxedUint

Source§

type Output = BoxedUint

Output type.
Source§

fn mul_mod(&self, rhs: &BoxedUint, p: &BoxedUint) -> BoxedUint

Compute self * rhs mod p.
Source§

impl NegMod for BoxedUint

Source§

type Output = BoxedUint

Output type.
Source§

fn neg_mod(&self, p: &BoxedUint) -> BoxedUint

Compute -self mod p.
Source§

impl Not for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the ! operator.
Source§

fn not(self) -> BoxedUint

Performs the unary ! operation. Read more
Source§

impl One for BoxedUint

Source§

fn one() -> BoxedUint

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn is_one(&self) -> bool

Returns true if self is equal to the multiplicative identity. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

impl Ord for BoxedUint

Source§

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

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

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

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

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

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

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

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

impl PartialEq<Odd<BoxedUint>> for BoxedUint

Source§

fn eq(&self, other: &Odd<BoxedUint>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialEq for BoxedUint

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd<Odd<BoxedUint>> for BoxedUint

Source§

fn partial_cmp(&self, other: &Odd<BoxedUint>) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl PartialOrd for BoxedUint

Source§

fn partial_cmp(&self, other: &BoxedUint) -> 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

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

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

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Rem<&NonZero<BoxedUint>> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the % operator.
Source§

fn rem( self, rhs: &NonZero<BoxedUint>, ) -> <&BoxedUint as Rem<&NonZero<BoxedUint>>>::Output

Performs the % operation. Read more
Source§

impl Rem<&NonZero<BoxedUint>> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the % operator.
Source§

fn rem( self, rhs: &NonZero<BoxedUint>, ) -> <BoxedUint as Rem<&NonZero<BoxedUint>>>::Output

Performs the % operation. Read more
Source§

impl Rem<NonZero<BoxedUint>> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the % operator.
Source§

fn rem( self, rhs: NonZero<BoxedUint>, ) -> <&BoxedUint as Rem<NonZero<BoxedUint>>>::Output

Performs the % operation. Read more
Source§

impl Rem<NonZero<BoxedUint>> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the % operator.
Source§

fn rem( self, rhs: NonZero<BoxedUint>, ) -> <BoxedUint as Rem<NonZero<BoxedUint>>>::Output

Performs the % operation. Read more
Source§

impl RemAssign<&NonZero<BoxedUint>> for BoxedUint

Source§

fn rem_assign(&mut self, rhs: &NonZero<BoxedUint>)

Performs the %= operation. Read more
Source§

impl RemAssign<NonZero<BoxedUint>> for BoxedUint

Source§

fn rem_assign(&mut self, rhs: NonZero<BoxedUint>)

Performs the %= operation. Read more
Source§

impl RemLimb for BoxedUint

Source§

fn rem_limb_with_reciprocal(&self, reciprocal: &Reciprocal) -> Limb

Computes self % rhs.
Source§

fn rem_limb(&self, rhs: NonZero<Limb>) -> Limb

Computes self % rhs using a pre-made reciprocal.
Source§

impl RemMixed<BoxedUint> for BoxedUint

Source§

fn rem_mixed(&self, reductor: &NonZero<BoxedUint>) -> BoxedUint

Calculate the remainder of self by the reductor.
Source§

impl Resize for &BoxedUint

Source§

type Output = BoxedUint

The result of the resizing.
Source§

fn resize_unchecked( self, at_least_bits_precision: u32, ) -> <&BoxedUint as Resize>::Output

Resizes to the minimum storage that fits at_least_bits_precision without checking if the bit size of self is larger than at_least_bits_precision. Read more
Source§

fn try_resize(self, at_least_bits_precision: u32) -> Option<BoxedUint>

Resizes to the minimum storage that fits at_least_bits_precision returning None if the bit size of self is larger than at_least_bits_precision. Read more
Source§

fn resize(self, at_least_bits_precision: u32) -> Self::Output

Resizes to the minimum storage that fits at_least_bits_precision panicking if the bit size of self is larger than at_least_bits_precision. Read more
Source§

impl Resize for BoxedUint

Source§

type Output = BoxedUint

The result of the resizing.
Source§

fn resize_unchecked( self, at_least_bits_precision: u32, ) -> <BoxedUint as Resize>::Output

Resizes to the minimum storage that fits at_least_bits_precision without checking if the bit size of self is larger than at_least_bits_precision. Read more
Source§

fn try_resize(self, at_least_bits_precision: u32) -> Option<BoxedUint>

Resizes to the minimum storage that fits at_least_bits_precision returning None if the bit size of self is larger than at_least_bits_precision. Read more
Source§

fn resize(self, at_least_bits_precision: u32) -> Self::Output

Resizes to the minimum storage that fits at_least_bits_precision panicking if the bit size of self is larger than at_least_bits_precision. Read more
Source§

impl Shl<i32> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the << operator.
Source§

fn shl(self, shift: i32) -> BoxedUint

Performs the << operation. Read more
Source§

impl Shl<i32> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the << operator.
Source§

fn shl(self, shift: i32) -> BoxedUint

Performs the << operation. Read more
Source§

impl Shl<u32> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the << operator.
Source§

fn shl(self, shift: u32) -> BoxedUint

Performs the << operation. Read more
Source§

impl Shl<u32> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the << operator.
Source§

fn shl(self, shift: u32) -> BoxedUint

Performs the << operation. Read more
Source§

impl Shl<usize> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the << operator.
Source§

fn shl(self, shift: usize) -> BoxedUint

Performs the << operation. Read more
Source§

impl Shl<usize> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the << operator.
Source§

fn shl(self, shift: usize) -> BoxedUint

Performs the << operation. Read more
Source§

impl ShlAssign<i32> for BoxedUint

Source§

fn shl_assign(&mut self, shift: i32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<u32> for BoxedUint

Source§

fn shl_assign(&mut self, shift: u32)

Performs the <<= operation. Read more
Source§

impl ShlAssign<usize> for BoxedUint

Source§

fn shl_assign(&mut self, shift: usize)

Performs the <<= operation. Read more
Source§

impl ShlVartime for BoxedUint

Source§

fn overflowing_shl_vartime(&self, shift: u32) -> CtOption<BoxedUint>

Computes self << shift. Read more
Source§

fn wrapping_shl_vartime(&self, shift: u32) -> BoxedUint

Computes self << shift in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.
Source§

impl Shr<i32> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the >> operator.
Source§

fn shr(self, shift: i32) -> BoxedUint

Performs the >> operation. Read more
Source§

impl Shr<i32> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the >> operator.
Source§

fn shr(self, shift: i32) -> BoxedUint

Performs the >> operation. Read more
Source§

impl Shr<u32> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the >> operator.
Source§

fn shr(self, shift: u32) -> BoxedUint

Performs the >> operation. Read more
Source§

impl Shr<u32> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the >> operator.
Source§

fn shr(self, shift: u32) -> BoxedUint

Performs the >> operation. Read more
Source§

impl Shr<usize> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the >> operator.
Source§

fn shr(self, shift: usize) -> BoxedUint

Performs the >> operation. Read more
Source§

impl Shr<usize> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the >> operator.
Source§

fn shr(self, shift: usize) -> BoxedUint

Performs the >> operation. Read more
Source§

impl ShrAssign<i32> for BoxedUint

Source§

fn shr_assign(&mut self, shift: i32)

Performs the >>= operation. Read more
Source§

impl ShrAssign<u32> for BoxedUint

Source§

fn shr_assign(&mut self, shift: u32)

Performs the >>= operation. Read more
Source§

impl ShrAssign<usize> for BoxedUint

Source§

fn shr_assign(&mut self, shift: usize)

Performs the >>= operation. Read more
Source§

impl ShrVartime for BoxedUint

Source§

fn overflowing_shr_vartime(&self, shift: u32) -> CtOption<BoxedUint>

Computes self >> shift. Read more
Source§

fn wrapping_shr_vartime(&self, shift: u32) -> BoxedUint

Computes self >> shift in a panic-free manner, masking off bits of shift which would cause the shift to exceed the type’s width.
Source§

impl SquareRoot for BoxedUint

Source§

fn sqrt(&self) -> BoxedUint

Computes floor(sqrt(self)).
Source§

fn sqrt_vartime(&self) -> BoxedUint

Computes floor(sqrt(self)), variable time in self.
Source§

impl Sub<&BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &BoxedUint) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<&BoxedUint> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &BoxedUint) -> BoxedUint

Performs the - operation. Read more
Source§

impl<const LIMBS: usize> Sub<&Uint<LIMBS>> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Uint<LIMBS>) -> BoxedUint

Performs the - operation. Read more
Source§

impl<const LIMBS: usize> Sub<&Uint<LIMBS>> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Uint<LIMBS>) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<BoxedUint> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: BoxedUint) -> BoxedUint

Performs the - operation. Read more
Source§

impl<const LIMBS: usize> Sub<Uint<LIMBS>> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Uint<LIMBS>) -> BoxedUint

Performs the - operation. Read more
Source§

impl<const LIMBS: usize> Sub<Uint<LIMBS>> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Uint<LIMBS>) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u128> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u128) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u128> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u128) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u16> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u16) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u16> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u16) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u32> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u32) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u32> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u32) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u64> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u64) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u64> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u64) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u8> for &BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u8) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub<u8> for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: u8) -> BoxedUint

Performs the - operation. Read more
Source§

impl Sub for BoxedUint

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: BoxedUint) -> BoxedUint

Performs the - operation. Read more
Source§

impl SubAssign<&BoxedUint> for BoxedUint

Source§

fn sub_assign(&mut self, rhs: &BoxedUint)

Performs the -= operation. Read more
Source§

impl<const LIMBS: usize> SubAssign<&Uint<LIMBS>> for BoxedUint

Source§

fn sub_assign(&mut self, rhs: &Uint<LIMBS>)

Performs the -= operation. Read more
Source§

impl<const LIMBS: usize> SubAssign<Uint<LIMBS>> for BoxedUint

Source§

fn sub_assign(&mut self, rhs: Uint<LIMBS>)

Performs the -= operation. Read more
Source§

impl SubAssign<u128> for BoxedUint

Source§

fn sub_assign(&mut self, rhs: u128)

Performs the -= operation. Read more
Source§

impl SubAssign<u16> for BoxedUint

Source§

fn sub_assign(&mut self, rhs: u16)

Performs the -= operation. Read more
Source§

impl SubAssign<u32> for BoxedUint

Source§

fn sub_assign(&mut self, rhs: u32)

Performs the -= operation. Read more
Source§

impl SubAssign<u64> for BoxedUint

Source§

fn sub_assign(&mut self, rhs: u64)

Performs the -= operation. Read more
Source§

impl SubAssign<u8> for BoxedUint

Source§

fn sub_assign(&mut self, rhs: u8)

Performs the -= operation. Read more
Source§

impl SubAssign for BoxedUint

Source§

fn sub_assign(&mut self, rhs: BoxedUint)

Performs the -= operation. Read more
Source§

impl SubMod for BoxedUint

Source§

type Output = BoxedUint

Output type.
Source§

fn sub_mod(&self, rhs: &BoxedUint, p: &BoxedUint) -> BoxedUint

Compute self - rhs mod p. Read more
Source§

impl TryFrom<&BoxedUint> for Mpint

Available on crate feature alloc only.
Source§

type Error = Error

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

fn try_from(uint: &Uint) -> Result<Mpint>

Performs the conversion.
Source§

impl TryFrom<&Mpint> for Uint

Available on crate feature alloc only.
Source§

type Error = Error

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

fn try_from(mpint: &Mpint) -> Result<Uint>

Performs the conversion.
Source§

impl TryFrom<BoxedUint> for Mpint

Available on crate feature alloc only.
Source§

type Error = Error

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

fn try_from(uint: Uint) -> Result<Mpint>

Performs the conversion.
Source§

impl TryFrom<Mpint> for Uint

Available on crate feature alloc only.
Source§

type Error = Error

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

fn try_from(mpint: Mpint) -> Result<Uint>

Performs the conversion.
Source§

impl UpperHex for BoxedUint

Source§

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

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

impl WrappingAdd for BoxedUint

Source§

fn wrapping_add(&self, v: &BoxedUint) -> BoxedUint

Wrapping (modular) addition. Computes self + other, wrapping around at the boundary of the type.
Source§

impl WrappingMul for BoxedUint

Source§

fn wrapping_mul(&self, v: &BoxedUint) -> BoxedUint

Wrapping (modular) multiplication. Computes self * other, wrapping around at the boundary of the type.
Source§

impl WrappingNeg for BoxedUint

Source§

fn wrapping_neg(&self) -> BoxedUint

Wrapping (modular) negation. Computes -self, wrapping around at the boundary of the type. Read more
Source§

impl WrappingShl for BoxedUint

Source§

fn wrapping_shl(&self, shift: u32) -> BoxedUint

Panic-free bitwise shift-left; yields self << mask(rhs), where mask removes any high order bits of rhs that would cause the shift to exceed the bitwidth of the type. Read more
Source§

impl WrappingShr for BoxedUint

Source§

fn wrapping_shr(&self, shift: u32) -> BoxedUint

Panic-free bitwise shift-right; yields self >> mask(rhs), where mask removes any high order bits of rhs that would cause the shift to exceed the bitwidth of the type. Read more
Source§

impl WrappingSub for BoxedUint

Source§

fn wrapping_sub(&self, v: &BoxedUint) -> BoxedUint

Wrapping (modular) subtraction. Computes self - other, wrapping around at the boundary of the type.
Source§

impl Zero for BoxedUint

Source§

fn zero() -> BoxedUint

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl Zero for BoxedUint

Source§

fn zero() -> BoxedUint

The value 0.
Source§

fn is_zero(&self) -> Choice

Determine if this value is equal to zero. Read more
Source§

fn set_zero(&mut self)

Set self to its additive identity, i.e. Self::zero.
Source§

fn zero_like(other: &Self) -> Self
where Self: Clone,

Return the value 0 with the same precision as other.
Source§

impl Eq for BoxedUint

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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, Rhs> InvMod<Rhs> for T
where T: InvertMod<Rhs>,

Source§

type Output = <T as InvertMod<Rhs>>::Output

👎Deprecated since 0.7.0: please use InvertMod instead
Output type.
Source§

fn inv_mod(&self, p: &Rhs) -> CtOption<<T as InvMod<Rhs>>::Output>

👎Deprecated since 0.7.0: please use InvertMod instead
Compute 1 / self mod p.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T, Rhs> WideningMul<Rhs> for T
where T: ConcatenatingMul<Rhs>,

Source§

type Output = <T as ConcatenatingMul<Rhs>>::Output

👎Deprecated since 0.7.0: please use ConcatenatingMul instead
Output of the widening multiplication.
Source§

fn widening_mul(&self, rhs: Rhs) -> <T as WideningMul<Rhs>>::Output

👎Deprecated since 0.7.0: please use ConcatenatingMul instead
Perform widening multiplication.
Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,