Skip to main content

Uint

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: impl AsRef<UintRef>, carry: Limb, ) -> (BoxedUint, Limb)

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

The result is widened to the same width as the widest input.

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 self + rhs + carry in-place, returning the new carry.

§Panics
  • if rhs has a larger precision than self.
Source

pub fn concatenating_add(&self, rhs: impl AsRef<UintRef>) -> BoxedUint

Computes self + rhs, returning a result which is concatenated with the overflow limb which would be returned if carrying_add were called with the same operands.

Source

pub fn overflowing_add(&self, rhs: impl AsRef<UintRef>) -> (BoxedUint, Choice)

Computes self + rhs, returning a tuple of the sum along with a Choice which indicates whether an overflow occurred.

If an overflow occurred, then the wrapped value is returned.

Source

pub fn overflowing_add_assign(&mut self, rhs: impl AsRef<UintRef>) -> Choice

Adds rhs to self, returning a Choice which indicates whether an overflow occurred.

If an overflow occurred, then the wrapped value is returned.

Source

pub fn wrapping_add(&self, rhs: impl AsRef<UintRef>) -> BoxedUint

Perform wrapping addition, discarding overflow.

Source

pub fn wrapping_add_assign(&mut self, rhs: impl AsRef<UintRef>)

Perform wrapping addition of rhs to self, discarding overflow.

Source§

impl BoxedUint

Source

pub fn add_mod(&self, rhs: &BoxedUint, p: &NonZero<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: &NonZero<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: &NonZero<BoxedUint>) -> BoxedUint

Computes self + self mod p.

Assumes self as unbounded integer is < p.

Source

pub fn add_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 integer is < 2p.

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: impl AsRef<UintRef>) -> 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<Rhs>( &self, rhs: &NonZero<Rhs>, ) -> (BoxedUint, <Rhs as ToUnsigned>::Unsigned)
where Rhs: ToUnsigned + ?Sized,

Computes self / rhs, returns the quotient, remainder.

Source

pub fn rem<Rhs>(&self, rhs: &NonZero<Rhs>) -> <Rhs as ToUnsigned>::Unsigned
where Rhs: ToUnsigned + ?Sized,

Computes self % rhs, returns the remainder.

Source

pub fn div_rem_vartime<Rhs>( &self, rhs: &NonZero<Rhs>, ) -> (BoxedUint, <Rhs as ToUnsigned>::Unsigned)
where Rhs: ToUnsigned + ?Sized,

Computes self / rhs, returns the quotient and remainder.

Variable-time with respect to rhs

Source

pub fn rem_vartime<Rhs>( &self, rhs: &NonZero<Rhs>, ) -> <Rhs as ToUnsigned>::Unsigned
where Rhs: ToUnsigned + ?Sized,

Computes self % rhs, returns the remainder.

Variable-time with respect to rhs.

Source

pub fn wrapping_div<Rhs>(&self, rhs: &NonZero<Rhs>) -> BoxedUint
where Rhs: ToUnsigned + ?Sized,

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<Rhs>(&self, rhs: &NonZero<Rhs>) -> BoxedUint
where Rhs: ToUnsigned + ?Sized,

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: impl AsRef<UintRef>) -> 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.

§Errors
Source

pub fn from_be_slice_vartime(bytes: &[u8]) -> BoxedUint

Create a new BoxedUint from the provided big endian bytes, automatically selecting its precision based on the size of the input.

This method is variable-time with respect to all subsequent operations since it chooses the limb count based on the input size, and is therefore only suitable for public inputs.

When working with secret values, use BoxedUint::from_be_slice.

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.

§Errors
Source

pub fn from_le_slice_vartime(bytes: &[u8]) -> BoxedUint

Create a new BoxedUint from the provided little endian bytes, automatically selecting its precision based on the size of the input.

This method is variable-time with respect to all subsequent operations since it chooses the limb count based on the input size, and is therefore only suitable for public inputs.

When working with secret values, use BoxedUint::from_le_slice.

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.

§Panics
  • if hex string is not the expected size
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.

§Errors
  • Returns DecodeError::InvalidDigit if the input value contains non-digit characters or digits outside of the range 0..radix.
§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.

§Errors
§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 invert_odd_mod_vartime( &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, or k > bits_precision()), 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, or k > bits_precision()), 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, or k > bits_precision()), 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, or k > bits_precision()), 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 multiplicative 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: &NonZero<BoxedUint>) -> CtOption<BoxedUint>

Computes the multiplicative 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: impl AsRef<UintRef>) -> BoxedUint

👎Deprecated since 0.7.0:

please use concatenating_mul

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: impl AsRef<UintRef>) -> BoxedUint

Perform wrapping multiplication, wrapping to the width of self.

Source

pub fn checked_mul(&self, rhs: impl AsRef<UintRef>) -> CtOption<BoxedUint>

Multiply self by rhs, wrapping to the width of self. Returns CtOption::None if the result overflowed the precision of self.

Source

pub fn saturating_mul(&self, rhs: impl AsRef<UintRef>) -> BoxedUint

Perform saturating multiplication, returning MAX on overflow.

Source

pub fn square(&self) -> BoxedUint

👎Deprecated since 0.7.0:

please use concatenating_square

Multiply self by itself.

Source

pub fn wrapping_square(&self) -> BoxedUint

Multiply self by itself, wrapping to the width of self.

Source

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

Multiply self by itself, wrapping to the width of self. Returns CtOption::None if the result overflowed the precision of self.

Source

pub fn saturating_square(&self) -> BoxedUint

Perform saturating squaring, returning MAX on overflow.

Source§

impl BoxedUint

Source

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

Computes self * rhs mod p for non-zero p.

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

pub fn square_mod(&self, p: &NonZero<BoxedUint>) -> BoxedUint

Computes self * self mod p.

Source

pub fn square_mod_vartime(&self, p: &NonZero<BoxedUint>) -> BoxedUint

Computes self * self mod p in variable time with respect to p.

Source§

impl BoxedUint

Source

pub fn wrapping_neg(&self) -> BoxedUint

Perform wrapping negation.

Source§

impl BoxedUint

Source

pub fn neg_mod(&self, p: &NonZero<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 checked_pow(&self, exp: impl AsRef<UintRef>) -> CtOption<BoxedUint>

Computes self^exp, returning a CtOption which is none in the case of overflow.

Source

pub fn checked_pow_bounded_exp( &self, exp: impl AsRef<UintRef>, exp_bits: u32, ) -> CtOption<BoxedUint>

Computes self^exp, returning a CtOption which is none in the case of overflow.

NOTE: exp_bits may be leaked in the time pattern.

§Panics
  • if exp_bits exceeds the capacity of rhs
Source

pub fn checked_pow_vartime( &self, exp: impl AsRef<UintRef>, ) -> CtOption<BoxedUint>

Computes self^exp, returning a CtOption which is none in the case of overflow.

This method is variable time in the exponent exp only.

Source

pub fn saturating_pow(&self, exp: impl AsRef<UintRef>) -> BoxedUint

Computes self^exp, returning a Self::MAX in the case of overflow.

Source

pub fn saturating_pow_bounded_exp( &self, exp: impl AsRef<UintRef>, exp_bits: u32, ) -> BoxedUint

Computes self^exp, returning a Self::MAX in the case of overflow.

NOTE: exp_bits may be leaked in the time pattern.

§Panics
  • if exp_bits exceeds the capacity of rhs
Source

pub fn saturating_pow_vartime(&self, exp: impl AsRef<UintRef>) -> BoxedUint

Computes self^exp, returning a Self::MAX in the case of overflow.

This method is variable time in the exponent exp.

Source

pub fn wrapping_pow(&self, exp: impl AsRef<UintRef>) -> BoxedUint

Computes self^exp, discarding overflow.

Source

pub fn wrapping_pow_bounded_exp( &self, exp: impl AsRef<UintRef>, exp_bits: u32, ) -> BoxedUint

Computes self^exp, discarding overflow.

NOTE: exp_bits may be leaked in the time pattern.

§Panics
  • if exp_bits exceeds the capacity of rhs
Source

pub fn wrapping_pow_vartime(&self, exp: impl AsRef<UintRef>) -> BoxedUint

Computes self^exp, discarding overflow.

This method is variable time in the exponent exp only.

Source§

impl BoxedUint

Source

pub fn pow_mod(&self, rhs: &BoxedUint, p: &Odd<BoxedUint>) -> BoxedUint

Computes self ^ rhs mod p for odd p.

Source§

impl BoxedUint

Source

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

Computes self << shift.

§Panics
  • if shift >= self.bits_precision().
Source

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

Computes self <<= shift.

§Panics
  • if shift >= self.bits_precision().
Source

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

Computes self << shift.

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

Source

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

Computes self << shift in variable-time.

Returns None if shift >= self.bits_precision(), otherwise the shifted result.

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 overflowing_shl_assign_vartime(&mut self, shift: u32) -> bool

Computes self <<= shift in variable-time.

If shift >= self.bits_precision(), shifts self in place and returns false. Otherwise returns true and leaves self unmodified.

Source

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

Computes self << shift in a panic-free manner, producing zero in the case of overflow.

Source

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

Computes self <<= shift in a panic-free manner, producing zero in the case of overflow.

Source

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

Computes self << shift in variable-time in a panic-free manner, producing zero in the case of overflow.

Source

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

Computes self <<= shift in variable-time in a panic-free manner, producing zero in the case of overflow.

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_assign(&mut self, shift: u32)

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 wrapping_shl_assign_vartime(&mut self, shift: u32)

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_precision().
Source

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

Computes self >>= shift.

§Panics
  • if shift >= self.bits_precision().
Source

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

Computes self >> shift.

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

Source

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

Computes self >> shift in variable-time.

Returns None if shift >= self.bits_precision(), otherwise the shifted result.

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 overflowing_shr_assign_vartime(&mut self, shift: u32) -> bool

Computes self >>= shift in variable-time.

If shift >= self.bits_precision(), shifts self in place and returns false. Otherwise returns true and leaves self unmodified.

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

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

Computes self >> shift in a panic-free manner, producing zero in the case of overflow.

Source

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

Computes self >>= shift in a panic-free manner, producing zero in the case of overflow.

Source

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

Computes self >> shift in variable-time in a panic-free manner, producing zero in the case of overflow.

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

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

Computes self >>= shift in variable-time in a panic-free manner, producing zero in the case of overflow.

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

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

Computes self >> shift in a panic-free manner, reducing shift modulo the type’s width.

Source

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

Computes self >>= shift in a panic-free manner, reducing shift modulo 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, reducing shift modulo the type’s width.

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

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

Computes self >>= shift in variable-time in a panic-free manner, reducing shift modulo the type’s width.

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

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

👎Deprecated since 0.7.0:

please use floor_sqrt instead

Computes floor(√(self)) in constant time.

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

Source

pub fn floor_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

👎Deprecated since 0.7.0:

please use floor_sqrt_vartime instead

Computes floor(√(self)).

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

Variable time with respect to self.

Source

pub fn floor_sqrt_vartime(&self) -> BoxedUint

Computes √(self).

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

Variable time with respect to self.

Source

pub fn wrapping_sqrt(&self) -> BoxedUint

Wrapped sqrt is just floor(√(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 floor(√(self)). There’s no way wrapping could ever happen. This function exists so that all operations are accounted for in the wrapping operations.

Variable time with respect to self.

Source

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

Perform checked sqrt, returning a CtOption which is_some only if the square root is exact.

Source

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

Perform checked sqrt, returning an Option which is_some only if the square root is exact.

Variable time with respect to 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: impl AsRef<UintRef>, borrow: Limb, ) -> (BoxedUint, Limb)

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

The result is widened to the same width as the widest input.

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 underflowing_sub(&self, rhs: impl AsRef<UintRef>) -> (BoxedUint, Choice)

Computes self - rhs, returning a tuple of the difference along with a Choice which indicates whether an underflow occurred.

If an underflow occurred, then the wrapped value is returned.

Source

pub fn underflowing_sub_assign(&mut self, rhs: impl AsRef<UintRef>) -> Choice

Subtracts rhs from self, returning a Choice which indicates whether an underflow occurred.

If an underflow occurred, then the wrapped value is returned.

Source

pub fn wrapping_sub(&self, rhs: impl AsRef<UintRef>) -> BoxedUint

Perform wrapping subtraction, discarding underflow.

Source

pub fn wrapping_sub_assign(&mut self, rhs: impl AsRef<UintRef>)

Perform wrapping subtraction of rhs from self, discarding underflow.

Source§

impl BoxedUint

Source

pub fn sub_mod(&self, rhs: &BoxedUint, p: &NonZero<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 from_words_with_precision( words: impl IntoIterator<Item = u64>, at_least_bits_precision: u32, ) -> BoxedUint

Create a BoxedUint from an array of Words (i.e. word-sized unsigned integers), specifying the precision of the result. Any words above the given precision will be dropped.

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 const fn as_uint_ref(&self) -> &UintRef

Borrow the limbs of this BoxedUint as a UintRef.

Source

pub const fn as_mut_uint_ref(&mut self) -> &mut UintRef

Mutably borrow the limbs of this BoxedUint as a UintRef.

Source

pub fn nlimbs(&self) -> usize

Get the number of limbs in this BoxedUint.

Source

pub fn to_nz(&self) -> CtOption<NonZero<BoxedUint>>

Convert to a NonZero<BoxedUint>.

Returns some if the original value is non-zero, and false otherwise.

Source

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

Convert to an Odd<BoxedUint>.

Returns some if the original value is odd, and false otherwise.

Source

pub fn into_nz(self) -> CtOption<NonZero<BoxedUint>>

Convert to a NonZero<BoxedUint>.

Returns some if the original value is non-zero, and false otherwise.

Source

pub fn into_odd(self) -> CtOption<Odd<BoxedUint>>

Convert to an Odd<BoxedUint>.

Returns some if the original value is odd, and false otherwise.

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<Rhs> Add<Rhs> for &BoxedUint
where Rhs: AsRef<UintRef>,

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl<Rhs> Add<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

type Output = BoxedUint

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Rhs) -> 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 as Add<Uint<crypto_bigint::::uint::U64::{constant#0}>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u16) -> <&BoxedUint as Add<u16>>::Output

Performs the + operation. Read more
Source§

impl Add<u16> for BoxedUint

Source§

type Output = <BoxedUint as Add<Uint<crypto_bigint::::uint::U64::{constant#0}>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u16) -> <BoxedUint as Add<u16>>::Output

Performs the + operation. Read more
Source§

impl Add<u32> for &BoxedUint

Source§

type Output = <&BoxedUint as Add<Uint<crypto_bigint::::uint::U64::{constant#0}>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u32) -> <&BoxedUint as Add<u32>>::Output

Performs the + operation. Read more
Source§

impl Add<u32> for BoxedUint

Source§

type Output = <BoxedUint as Add<Uint<crypto_bigint::::uint::U64::{constant#0}>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u32) -> <BoxedUint as Add<u32>>::Output

Performs the + operation. Read more
Source§

impl Add<u64> for &BoxedUint

Source§

type Output = <&BoxedUint as Add<Uint<crypto_bigint::::uint::U64::{constant#0}>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u64) -> <&BoxedUint as Add<u64>>::Output

Performs the + operation. Read more
Source§

impl Add<u64> for BoxedUint

Source§

type Output = <BoxedUint as Add<Uint<crypto_bigint::::uint::U64::{constant#0}>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u64) -> <BoxedUint as Add<u64>>::Output

Performs the + operation. Read more
Source§

impl Add<u8> for &BoxedUint

Source§

type Output = <&BoxedUint as Add<Uint<crypto_bigint::::uint::U64::{constant#0}>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u8) -> <&BoxedUint as Add<u8>>::Output

Performs the + operation. Read more
Source§

impl Add<u8> for BoxedUint

Source§

type Output = <BoxedUint as Add<Uint<crypto_bigint::::uint::U64::{constant#0}>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: u8) -> <BoxedUint as Add<u8>>::Output

Performs the + operation. Read more
Source§

impl<Rhs> AddAssign<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

fn add_assign(&mut self, rhs: Rhs)

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

Source§

type Output = BoxedUint

Output type.
Source§

fn add_mod(&self, rhs: &BoxedUint, p: &NonZero<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 Borrow<UintRef> for BoxedUint

Source§

fn borrow(&self) -> &UintRef

Immutably borrows from an owned value. Read more
Source§

impl BorrowMut<UintRef> for BoxedUint

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<Rhs> CheckedAdd<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

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

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

impl<Rhs> CheckedDiv<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

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

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

impl<Rhs> CheckedMul<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

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

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

impl CheckedSquareRoot for BoxedUint

Source§

type Output = BoxedUint

Output of the square root operation.
Source§

fn checked_sqrt(&self) -> CtOption<<BoxedUint as CheckedSquareRoot>::Output>

Computes sqrt(self), returning none if no root exists.
Source§

fn checked_sqrt_vartime( &self, ) -> Option<<BoxedUint as CheckedSquareRoot>::Output>

Computes sqrt(self), returning none if no root exists. Read more
Source§

impl<Rhs> CheckedSub<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

fn checked_sub(&self, rhs: &Rhs) -> 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 duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<Rhs> ConcatenatingMul<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

type Output = BoxedUint

Output of the widening multiplication.
Source§

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

Perform widening multiplication.
Source§

impl ConcatenatingSquare for BoxedUint

Source§

type Output = BoxedUint

Output of the widening multiplication.
Source§

fn concatenating_square(&self) -> BoxedUint

Perform widening squaring.
Source§

impl CtAssign for BoxedUint

Source§

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

Conditionally assign src to self if choice is Choice::TRUE.
Source§

impl CtAssignSlice for BoxedUint

Source§

fn ct_assign_slice(dst: &mut [Self], src: &[Self], choice: Choice)

Conditionally assign src to dst if choice is Choice::TRUE, or leave it unchanged for Choice::FALSE.
Source§

impl<Rhs> CtEq<Rhs> for BoxedUint
where Rhs: AsRef<UintRef> + ?Sized,

Source§

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

Determine if self is equal to other in constant-time.
Source§

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

Determine if self is NOT equal to other in constant-time.
Source§

impl CtEqSlice for BoxedUint

Source§

fn ct_eq_slice(a: &[Self], b: &[Self]) -> Choice

Determine if a is equal to b in constant-time.
Source§

fn ct_ne_slice(a: &[Self], b: &[Self]) -> Choice

Determine if a is NOT equal to b in constant-time.
Source§

impl CtGt for BoxedUint

Source§

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

Compute whether self > other in constant time.
Source§

impl CtLt for BoxedUint

Source§

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

Compute whether self < other in constant time.
Source§

impl CtNeg for BoxedUint

Source§

fn ct_neg(&self, choice: Choice) -> BoxedUint

Conditionally negate self, returning -self if choice is Choice::TRUE, or self otherwise.
Source§

fn ct_neg_assign(&mut self, choice: Choice)

Conditionally negate self in-place, replacing it with -self if choice is Choice::TRUE.
Source§

impl CtSelect for BoxedUint

Source§

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

Select between self and other based on choice, returning a copy of the value. Read more
Source§

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

Conditionally swap self and other if choice is Choice::TRUE.
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<Rhs> Div<&NonZero<Rhs>> for &BoxedUint
where Rhs: ToUnsigned + ?Sized,

Source§

type Output = BoxedUint

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<Rhs> Div<&NonZero<Rhs>> for BoxedUint
where Rhs: ToUnsigned + ?Sized,

Source§

type Output = BoxedUint

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<Rhs> Div<NonZero<Rhs>> for &BoxedUint
where Rhs: AsMut<UintRef>,

Source§

type Output = BoxedUint

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<Rhs> Div<NonZero<Rhs>> for BoxedUint
where Rhs: AsMut<UintRef>,

Source§

type Output = BoxedUint

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl<Rhs> DivAssign<&NonZero<Rhs>> for BoxedUint
where Rhs: ToUnsigned + ?Sized,

Source§

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

Performs the /= operation. Read more
Source§

impl<Rhs> DivAssign<NonZero<Rhs>> for BoxedUint
where Rhs: AsMut<UintRef>,

Source§

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

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

Source§

type Repr = Box<[u8]>

Byte array representation.
Source§

fn to_be_bytes(&self) -> <BoxedUint as Encoding>::Repr

Encode to big endian bytes.
Source§

fn to_le_bytes(&self) -> <BoxedUint as Encoding>::Repr

Encode to little endian bytes.
Source§

fn from_be_bytes(bytes: <BoxedUint as Encoding>::Repr) -> BoxedUint

Decode from big endian bytes.
Source§

fn from_le_bytes(bytes: <BoxedUint as Encoding>::Repr) -> BoxedUint

Decode from little endian bytes.
Source§

impl FloorSquareRoot for BoxedUint

Source§

fn floor_sqrt(&self) -> BoxedUint

Computes floor(sqrt(self)).
Source§

fn floor_sqrt_vartime(&self) -> BoxedUint

Computes floor(sqrt(self)). Read more
Source§

impl From<&[Limb]> for BoxedUint

Source§

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

Converts to this type from the input type.
Source§

impl From<&BoxedUint> for Mpint

Available on crate feature alloc only.
Source§

fn from(uint: &Uint) -> Mpint

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

Source§

fn from(uint_ref: &UintRef) -> 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<BoxedUint> for Mpint

Available on crate feature alloc only.
Source§

fn from(uint: Uint) -> Mpint

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

Source§

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

Borrow the raw limbs used to represent this integer.
Source§

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

Mutably borrow the raw limbs used to represent this integer.
Source§

fn nlimbs(&self) -> usize

Number of limbs in this integer.
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: &NonZero<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<Rhs> Mul<Rhs> for &BoxedUint
where Rhs: AsRef<UintRef>,

Source§

type Output = BoxedUint

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<Rhs> Mul<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

type Output = BoxedUint

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl<Rhs> MulAssign<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

fn mul_assign(&mut self, rhs: Rhs)

Performs the *= operation. Read more
Source§

impl MulMod for BoxedUint

Source§

type Output = BoxedUint

Output type.
Source§

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

Compute self * rhs mod p.
Source§

impl NegMod for BoxedUint

Source§

type Output = BoxedUint

Output type.
Source§

fn neg_mod(&self, p: &NonZero<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.
Source§

fn one_like(other: &BoxedUint) -> BoxedUint

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

fn is_one(&self) -> Choice

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

fn set_one(&mut self)

Set self to its multiplicative identity, i.e. Self::one.
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 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · 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

Available on crate feature alloc only.
Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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<Rhs> PartialEq<Rhs> for BoxedUint
where Rhs: AsRef<UintRef> + ?Sized,

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · 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

Available on crate feature alloc only.
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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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<Rhs> PartialOrd<Rhs> for BoxedUint
where Rhs: AsRef<UintRef> + ?Sized,

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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<Rhs> Rem<&NonZero<Rhs>> for &BoxedUint
where Rhs: ToUnsigned + ?Sized,

Source§

type Output = <Rhs as ToUnsigned>::Unsigned

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl<Rhs> Rem<&NonZero<Rhs>> for BoxedUint
where Rhs: ToUnsigned + ?Sized,

Source§

type Output = <Rhs as ToUnsigned>::Unsigned

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl<Rhs> Rem<NonZero<Rhs>> for &BoxedUint
where Rhs: AsMut<UintRef>,

Source§

type Output = Rhs

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl<Rhs> Rem<NonZero<Rhs>> for BoxedUint
where Rhs: AsMut<UintRef>,

Source§

type Output = Rhs

The resulting type after applying the % operator.
Source§

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

Performs the % operation. Read more
Source§

impl<Rhs> RemAssign<&NonZero<Rhs>> for BoxedUint
where Rhs: AsRef<UintRef> + ?Sized,

Source§

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

Performs the %= operation. Read more
Source§

impl<Rhs> RemAssign<NonZero<Rhs>> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

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

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<Rhs> RemMixed<Rhs> for BoxedUint
where Rhs: Unsigned,

Source§

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

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

Computes self << shift. Read more
Source§

fn unbounded_shl_vartime(&self, shift: u32) -> 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) -> Option<BoxedUint>

Computes self >> shift. Read more
Source§

fn unbounded_shr_vartime(&self, shift: u32) -> 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 SquareMod for BoxedUint

Source§

type Output = BoxedUint

Output type.
Source§

fn square_mod(&self, p: &NonZero<BoxedUint>) -> BoxedUint

Compute self * self mod p.
Source§

impl<Rhs> Sub<Rhs> for &BoxedUint
where Rhs: AsRef<UintRef>,

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl<Rhs> Sub<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

type Output = BoxedUint

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Rhs) -> 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<Rhs> SubAssign<Rhs> for BoxedUint
where Rhs: AsRef<UintRef>,

Source§

fn sub_assign(&mut self, rhs: Rhs)

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

Source§

type Output = BoxedUint

Output type.
Source§

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

Compute self - rhs mod p. Read more
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<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 Unsigned for BoxedUint

Source§

fn as_uint_ref(&self) -> &UintRef

Borrow the limbs of this unsigned integer as a UintRef.
Source§

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

Mutably borrow the limbs of this unsigned integer as a UintRef.
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§

impl UnsignedWithMontyForm for BoxedUint

Source§

type MontyForm = BoxedMontyForm

The corresponding Montgomery representation, optimized for the performance of modular operations at the price of a conversion overhead.
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.
Source§

fn is_zero(&self) -> Choice

Determine if this value is equal to 0. 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 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 Eq for BoxedUint

Auto Trait Implementations§

Blanket Implementations§

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, 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> 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, const N: usize> CtSelectArray<N> for T

Source§

fn ct_select_array(a: &[T; N], b: &[T; N], choice: Choice) -> [T; N]

Select between a and b in constant-time based on choice.
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> 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> ToUnsigned for T
where T: Unsigned,

Source§

type Unsigned = T

The corresponding owned Unsigned type.
Source§

fn to_unsigned(&self) -> <T as ToUnsigned>::Unsigned

Convert from a reference into an owned instance.
Source§

fn to_unsigned_zero(&self) -> <T as ToUnsigned>::Unsigned

Convert from a reference into an owned instance representing zero.
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> 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>,