Struct crypto_bigint::Uint

source ·
pub struct Uint<const LIMBS: usize> { /* private fields */ }
Expand description

Big unsigned integer.

Generic over the given number of LIMBS

Encoding support

This type supports many different types of encodings, either via the Encoding trait or various const fn decoding and encoding functions that can be used with Uint constants.

Optional crate features for encoding (off-by-default):

Implementations§

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

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

source

pub const fn saturating_add(&self, rhs: &Self) -> Self

Perform saturating addition, returning MAX on overflow.

source

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

Perform wrapping addition, discarding overflow.

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

Computes self + rhs mod p in constant time.

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

source

pub const fn add_mod_special(&self, rhs: &Self, c: Limb) -> Self

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

Computes bitwise a & b.

source

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

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

Perform checked bitwise AND, returning a CtOption which is_some always

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const fn not(&self) -> Self

Computes bitwise !a.

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

Computes bitwise a & b.

source

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

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

Perform checked bitwise OR, returning a CtOption which is_some always

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

Computes bitwise a ^ b.

source

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

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

Perform checked bitwise XOR, returning a CtOption which is_some always

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

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

source

pub const fn bits_vartime(self) -> usize

Calculate the number of bits needed to represent this number.

source

pub const fn leading_zeros(self) -> usize

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

source

pub const fn trailing_zeros(self) -> usize

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

source

pub const fn bits(self) -> usize

Calculate the number of bits needed to represent this number.

source

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const fn ct_div_rem_limb_with_reciprocal( &self, reciprocal: &Reciprocal ) -> (Self, Limb)

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

source

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

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

source

pub const fn const_rem(&self, rhs: &Self) -> (Self, CtChoice)

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

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

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

source

pub const fn const_rem_wide( lower_upper: (Self, Self), rhs: &Self ) -> (Self, CtChoice)

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

This is variable only with respect to rhs.

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

source

pub const fn rem2k(&self, k: usize) -> Self

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

source

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

Computes self / rhs, returns the quotient, remainder.

source

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

Computes self % rhs, returns the remainder.

source

pub const fn wrapping_div(&self, rhs: &Self) -> Self

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

Panics if rhs == 0.

source

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

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

source

pub const fn wrapping_rem(&self, rhs: &Self) -> Self

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

Panics if rhs == 0.

source

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const fn from_be_slice(bytes: &[u8]) -> Self

Create a new Uint from the provided big endian bytes.

source

pub const fn from_be_hex(hex: &str) -> Self

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

source

pub const fn from_le_slice(bytes: &[u8]) -> Self

Create a new Uint from the provided little endian bytes.

source

pub const fn from_le_hex(hex: &str) -> Self

Create a new Uint from the provided little endian hex string.

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const fn from_u8(n: u8) -> Self

Create a Uint from a u8 (const-friendly)

source

pub const fn from_u16(n: u16) -> Self

Create a Uint from a u16 (const-friendly)

source

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

Create a Uint from a u32 (const-friendly)

source

pub const fn from_u64(n: u64) -> Self

Available on 64-bit only.

Create a Uint from a u64 (const-friendly)

source

pub const fn from_u128(n: u128) -> Self

Create a Uint from a u128 (const-friendly)

source

pub const fn from_word(n: Word) -> Self

Create a Uint from a Word (const-friendly)

source

pub const fn from_wide_word(n: WideWord) -> Self

Create a Uint from a WideWord (const-friendly)

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const fn inv_mod2k(&self, k: usize) -> Self

Computes 1/self mod 2^k as specified in Algorithm 4 from A Secure Algorithm for Inversion Modulo 2k by Sadiel de la Fe and Carles Ferrer. See https://www.mdpi.com/2410-387X/2/3/23.

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

source

pub const fn inv_odd_mod_bounded( &self, modulus: &Self, bits: usize, modulus_bits: usize ) -> (Self, CtChoice)

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

Note: variable time in bits and modulus_bits.

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

source

pub const fn inv_odd_mod(&self, modulus: &Self) -> (Self, CtChoice)

Computes the multiplicative inverse of self mod modulus, where modulus is odd. Returns (inverse, Word::MAX) if an inverse exists, otherwise (undefined, Word::ZERO).

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const fn mul_wide(&self, rhs: &Self) -> (Self, Self)

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

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

Ordering note

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

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

source

pub const fn saturating_mul(&self, rhs: &Self) -> Self

Perform saturating multiplication, returning MAX on overflow.

source

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

Perform wrapping multiplication, discarding overflow.

source

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

Square self, returning a concatenated “wide” result.

source

pub const fn square_wide(&self) -> (Self, Self)

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

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

source

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const fn shl_vartime(&self, n: usize) -> Self

Computes self << shift.

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

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

source

pub const fn shl_vartime_wide( lower_upper: (Self, Self), n: usize ) -> (Self, Self)

Computes a left shift on a wide input as (lo, hi).

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const fn shr_vartime(&self, shift: usize) -> Self

Computes self >> n.

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

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

source

pub const fn shr_vartime_wide( lower_upper: (Self, Self), n: usize ) -> (Self, Self)

Computes a right shift on a wide input as (lo, hi).

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const fn sqrt(&self) -> Self

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

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

source

pub const fn wrapping_sqrt(&self) -> Self

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

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

source

pub const fn saturating_sub(&self, rhs: &Self) -> Self

Perform saturating subtraction, returning ZERO on underflow.

source

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

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

Computes self - rhs mod p in constant time.

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

source

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

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

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

source§

impl<const LIMBS: usize> Uint<LIMBS>

source

pub const ZERO: Self = _

The value 0.

source

pub const ONE: Self = _

The value 1.

source

pub const MAX: Self = _

Maximum value this Uint can express.

source

pub const BITS: usize = _

Total size of the represented integer in bits.

source

pub const BYTES: usize = _

Total size of the represented integer in bytes.

source

pub const LIMBS: usize = LIMBS

The number of limbs used on this platform.

source

pub const fn new(limbs: [Limb; LIMBS]) -> Self

Const-friendly Uint constructor.

source

pub const fn from_words(arr: [Word; LIMBS]) -> Self

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

source

pub const fn to_words(self) -> [Word; LIMBS]

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

source

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

Borrow the inner limbs as an array of Words.

source

pub fn as_words_mut(&mut self) -> &mut [Word; LIMBS]

Borrow the inner limbs as a mutable array of Words.

source

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

Borrow the limbs of this Uint.

source

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

Borrow the limbs of this Uint mutably.

source

pub const fn to_limbs(self) -> [Limb; LIMBS]

Convert this Uint into its inner limbs.

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn concat(&self, rhs: &Self) -> Uint<{ _ }>

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

source§

impl Uint<{nlimbs!($bits)}>

source

pub const fn split(&self) -> (Uint<{ _ }>, Uint<{ _ }>)

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

Trait Implementations§

source§

impl<const LIMBS: usize> AddMod<Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

Output type.
source§

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

Compute self + rhs mod p. Read more
source§

impl<const LIMBS: usize> AsMut<[Limb]> for Uint<LIMBS>

source§

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

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

impl<const LIMBS: usize> AsMut<[u64; LIMBS]> for Uint<LIMBS>

source§

fn as_mut(&mut self) -> &mut [Word; LIMBS]

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

impl<const LIMBS: usize> AsRef<[Limb]> for Uint<LIMBS>

source§

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

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

impl<const LIMBS: usize> AsRef<[u64; LIMBS]> for Uint<LIMBS>

source§

fn as_ref(&self) -> &[Word; LIMBS]

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

impl<const LIMBS: usize> BitAnd<&Uint<LIMBS>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<const LIMBS: usize> BitAnd<&Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<const LIMBS: usize> BitAnd<Uint<LIMBS>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<const LIMBS: usize> BitAnd<Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the & operator.
source§

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

Performs the & operation. Read more
source§

impl<const LIMBS: usize> BitAndAssign<&Uint<LIMBS>> for Uint<LIMBS>

source§

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

Performs the &= operation. Read more
source§

impl<const LIMBS: usize> BitAndAssign<Uint<LIMBS>> for Uint<LIMBS>

source§

fn bitand_assign(&mut self, other: Self)

Performs the &= operation. Read more
source§

impl<const LIMBS: usize> BitOr<&Uint<LIMBS>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<const LIMBS: usize> BitOr<&Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<const LIMBS: usize> BitOr<Uint<LIMBS>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<const LIMBS: usize> BitOr<Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the | operator.
source§

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

Performs the | operation. Read more
source§

impl<const LIMBS: usize> BitOrAssign<&Uint<LIMBS>> for Uint<LIMBS>

source§

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

Performs the |= operation. Read more
source§

impl<const LIMBS: usize> BitOrAssign<Uint<LIMBS>> for Uint<LIMBS>

source§

fn bitor_assign(&mut self, other: Self)

Performs the |= operation. Read more
source§

impl<const LIMBS: usize> BitXor<&Uint<LIMBS>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<const LIMBS: usize> BitXor<&Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<const LIMBS: usize> BitXor<Uint<LIMBS>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<const LIMBS: usize> BitXor<Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the ^ operator.
source§

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

Performs the ^ operation. Read more
source§

impl<const LIMBS: usize> BitXorAssign<&Uint<LIMBS>> for Uint<LIMBS>

source§

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

Performs the ^= operation. Read more
source§

impl<const LIMBS: usize> BitXorAssign<Uint<LIMBS>> for Uint<LIMBS>

source§

fn bitxor_assign(&mut self, other: Self)

Performs the ^= operation. Read more
source§

impl<const LIMBS: usize> Bounded for Uint<LIMBS>

source§

const BITS: usize = Self::BITS

Size of this integer in bits.
source§

const BYTES: usize = Self::BYTES

Size of this integer in bytes.
source§

impl<const LIMBS: usize> CheckedAdd<&Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

Output type.
source§

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

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

impl<const LIMBS: usize> CheckedMul<&Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

Output type.
source§

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

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

impl<const LIMBS: usize> CheckedSub<&Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

Output type.
source§

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

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

impl<const LIMBS: usize> Clone for Uint<LIMBS>

source§

fn clone(&self) -> Uint<LIMBS>

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 Concat<Uint<{nlimbs!($bits)}>> for U1024

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U128

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U1536

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U1792

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U192

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U2048

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U256

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U3072

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U320

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U384

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U4096

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U448

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U512

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U64

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U640

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U768

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl Concat<Uint<{nlimbs!($bits)}>> for U896

§

type Output = Uint<{nlimbs!($bits) * 2}>

Concatenated output: twice the width of Self.
source§

fn concat(&self, rhs: &Self) -> Self::Output

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

impl<const LIMBS: usize> ConditionallySelectable for Uint<LIMBS>

source§

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

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

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

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

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

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

impl<const LIMBS: usize> ConstantTimeEq for Uint<LIMBS>

source§

fn ct_eq(&self, other: &Self) -> 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<const LIMBS: usize> ConstantTimeGreater for Uint<LIMBS>

source§

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

Determine whether self > other. Read more
source§

impl<const LIMBS: usize> ConstantTimeLess for Uint<LIMBS>

source§

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

Determine whether self < other. Read more
source§

impl<const LIMBS: usize> Debug for Uint<LIMBS>

source§

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

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

impl<const LIMBS: usize> Decodable for Uint<LIMBS>where Self: Encoding, <Self as Encoding>::Repr: Default,

Available on crate feature rlp only.
source§

fn decode(rlp: &Rlp<'_>) -> Result<Self, DecoderError>

Decode a value from RLP bytes
source§

impl<'a, const LIMBS: usize> DecodeValue<'a> for Uint<LIMBS>where Uint<LIMBS>: ArrayEncoding,

Available on crate features der and generic-array only.
source§

fn decode_value<R: Reader<'a>>(reader: &mut R, header: Header) -> Result<Self>

Attempt to decode this message using the provided Reader.
source§

impl<const LIMBS: usize> Default for Uint<LIMBS>

source§

fn default() -> Self

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

impl<'de, const LIMBS: usize> Deserialize<'de> for Uint<LIMBS>where Uint<LIMBS>: Encoding,

Available on crate feature serde only.
source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<const LIMBS: usize> Display for Uint<LIMBS>

source§

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

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

impl<const LIMBS: usize> Div<&NonZero<Limb>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<&NonZero<Limb>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the / operator.
source§

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

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<&NonZero<Uint<LIMBS>>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &NonZero<Uint<LIMBS>>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<&NonZero<Uint<LIMBS>>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: &NonZero<Uint<LIMBS>>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<NonZero<Limb>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: NonZero<Limb>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<NonZero<Limb>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: NonZero<Limb>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<NonZero<Uint<LIMBS>>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: NonZero<Uint<LIMBS>>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> Div<NonZero<Uint<LIMBS>>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the / operator.
source§

fn div(self, rhs: NonZero<Uint<LIMBS>>) -> Self::Output

Performs the / operation. Read more
source§

impl<const LIMBS: usize> DivAssign<&NonZero<Limb>> for Uint<LIMBS>

source§

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

Performs the /= operation. Read more
source§

impl<const LIMBS: usize> DivAssign<&NonZero<Uint<LIMBS>>> for Uint<LIMBS>

source§

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

Performs the /= operation. Read more
source§

impl<const LIMBS: usize> DivAssign<NonZero<Limb>> for Uint<LIMBS>

source§

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

Performs the /= operation. Read more
source§

impl<const LIMBS: usize> DivAssign<NonZero<Uint<LIMBS>>> for Uint<LIMBS>

source§

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

Performs the /= operation. Read more
source§

impl<const LIMBS: usize> Encodable for Uint<LIMBS>where Self: Encoding,

Available on crate feature rlp only.
source§

fn rlp_append(&self, stream: &mut RlpStream)

Append a value to the stream
source§

fn rlp_bytes(&self) -> BytesMut

Get rlp-encoded bytes for this instance
source§

impl<const LIMBS: usize> EncodeValue for Uint<LIMBS>where Uint<LIMBS>: ArrayEncoding,

Available on crate features der and generic-array only.
source§

fn value_len(&self) -> Result<Length>

Compute the length of this value (sans [Tag]+Length header) when encoded as ASN.1 DER.
source§

fn encode_value(&self, encoder: &mut impl Writer) -> Result<()>

Encode value (sans [Tag]+Length header) as ASN.1 DER using the provided Writer.
source§

fn header(&self) -> Result<Header, Error>where Self: Tagged,

Get the Header used to encode this value.
source§

impl<const LIMBS: usize> FixedTag for Uint<LIMBS>where Uint<LIMBS>: ArrayEncoding,

Available on crate features der and generic-array only.
source§

const TAG: Tag = Tag::Integer

ASN.1 tag
source§

impl<const LIMBS: usize> From<[Limb; LIMBS]> for Uint<LIMBS>

source§

fn from(limbs: [Limb; LIMBS]) -> Self

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<[u64; LIMBS]> for Uint<LIMBS>

source§

fn from(arr: [Word; LIMBS]) -> Self

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U896, U896)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U768, U768)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U4096, U4096)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U320, U320)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U1536, U1536)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U512, U512)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U256, U256)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U1792, U1792)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U128, U128)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U448, U448)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U192, U192)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U64, U64)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U2048, U2048)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U384, U384)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U1024, U1024)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U640, U640)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

impl From<(Uint<{nlimbs!($bits)}>, Uint<{nlimbs!($bits)}>)> for Uint<{ _ }>

source§

fn from(nums: (U3072, U3072)) -> Uint<{ _ }>

Converts to this type from the input type.
source§

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

source§

fn from(limb: Limb) -> Self

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U6144) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U128) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U1024) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U896) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U768) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U384) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U640) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U512) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U2048) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U3584) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U4096) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U8192) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U1792) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U256) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U1536) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U1280) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for (Uint<{ _ }>, Uint<{ _ }>)

source§

fn from(num: U3072) -> (Uint<{ _ }>, Uint<{ _ }>)

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for u128

source§

fn from(n: U128) -> u128

Converts to this type from the input type.
source§

impl From<Uint<{nlimbs!($bits)}>> for u64

Available on 64-bit only.
source§

fn from(n: U64) -> u64

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<Uint<LIMBS>> for [Limb; LIMBS]

source§

fn from(n: Uint<LIMBS>) -> [Limb; LIMBS]

Converts to this type from the input type.
source§

impl<const LIMBS: usize> From<Uint<LIMBS>> for [Word; LIMBS]

source§

fn from(n: Uint<LIMBS>) -> [Word; LIMBS]

Converts to this type from the input type.
source§

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

source§

fn from(n: u128) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(n: u16) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(n: u32) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(n: u64) -> Self

Converts to this type from the input type.
source§

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

source§

fn from(n: u8) -> Self

Converts to this type from the input type.
source§

impl<const LIMBS: usize> Hash for Uint<LIMBS>

source§

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

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

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

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

impl<const LIMBS: usize> Integer for Uint<LIMBS>

source§

const ONE: Self = Self::ONE

The value 1.
source§

const MAX: Self = Self::MAX

Maximum value this integer can express.
source§

const BITS: usize = Self::BITS

Total size of the represented integer in bits.
source§

const BYTES: usize = Self::BYTES

Total size of the represented integer in bytes.
source§

const LIMBS: usize = Self::LIMBS

The number of limbs used on this platform.
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<const LIMBS: usize> LowerHex for Uint<LIMBS>

source§

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

Formats the value using the given formatter.
source§

impl<const LIMBS: usize> NegMod for Uint<LIMBS>

§

type Output = Uint<LIMBS>

Output type.
source§

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

Compute -self mod p.
source§

impl<const LIMBS: usize> Not for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the ! operator.
source§

fn not(self) -> <Self as Not>::Output

Performs the unary ! operation. Read more
source§

impl<const LIMBS: usize> Ord for Uint<LIMBS>

source§

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

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

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

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

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

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

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

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

impl<const LIMBS: usize> PartialEq<Uint<LIMBS>> for Uint<LIMBS>

source§

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

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

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

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

impl<const LIMBS: usize> PartialOrd<Uint<LIMBS>> for Uint<LIMBS>

source§

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

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

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

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

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

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

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

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

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

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

impl<const LIMBS: usize> PowBoundedExp<Uint<LIMBS>> for DynResidue<LIMBS>

source§

fn pow_bounded_exp(&self, exponent: &Uint<LIMBS>, exponent_bits: usize) -> Self

Raises to the exponent power, with exponent_bits representing the number of (least significant) bits to take into account for the exponent. Read more
source§

impl<MOD: ResidueParams<LIMBS>, const LIMBS: usize> PowBoundedExp<Uint<LIMBS>> for Residue<MOD, LIMBS>

source§

fn pow_bounded_exp(&self, exponent: &Uint<LIMBS>, exponent_bits: usize) -> Self

Raises to the exponent power, with exponent_bits representing the number of (least significant) bits to take into account for the exponent. Read more
source§

impl<const LIMBS: usize> Random for Uint<LIMBS>

Available on crate feature rand_core only.
source§

fn random(rng: &mut impl CryptoRngCore) -> Self

Generate a cryptographically secure random Uint.

source§

impl<const LIMBS: usize> RandomMod for Uint<LIMBS>

Available on crate feature rand_core only.
source§

fn random_mod(rng: &mut impl CryptoRngCore, modulus: &NonZero<Self>) -> Self

Generate a cryptographically secure random Uint which is less than a given modulus.

This function uses rejection sampling, a method which produces an unbiased distribution of in-range values provided the underlying CSRNG is unbiased, but runs in variable-time.

The variable-time nature of the algorithm should not pose a security issue so long as the underlying random number generator is truly a CSRNG, where previous outputs are unrelated to subsequent outputs and do not reveal information about the RNG’s internal state.

source§

impl<const LIMBS: usize> Rem<&NonZero<Limb>> for &Uint<LIMBS>

§

type Output = Limb

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<&NonZero<Limb>> for Uint<LIMBS>

§

type Output = Limb

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<&NonZero<Uint<LIMBS>>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<&NonZero<Uint<LIMBS>>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the % operator.
source§

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

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<NonZero<Limb>> for &Uint<LIMBS>

§

type Output = Limb

The resulting type after applying the % operator.
source§

fn rem(self, rhs: NonZero<Limb>) -> Self::Output

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<NonZero<Limb>> for Uint<LIMBS>

§

type Output = Limb

The resulting type after applying the % operator.
source§

fn rem(self, rhs: NonZero<Limb>) -> Self::Output

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<NonZero<Uint<LIMBS>>> for &Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: NonZero<Uint<LIMBS>>) -> Self::Output

Performs the % operation. Read more
source§

impl<const LIMBS: usize> Rem<NonZero<Uint<LIMBS>>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

The resulting type after applying the % operator.
source§

fn rem(self, rhs: NonZero<Uint<LIMBS>>) -> Self::Output

Performs the % operation. Read more
source§

impl<const LIMBS: usize> RemAssign<&NonZero<Limb>> for Uint<LIMBS>

source§

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

Performs the %= operation. Read more
source§

impl<const LIMBS: usize> RemAssign<&NonZero<Uint<LIMBS>>> for Uint<LIMBS>

source§

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

Performs the %= operation. Read more
source§

impl<const LIMBS: usize> RemAssign<NonZero<Limb>> for Uint<LIMBS>

source§

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

Performs the %= operation. Read more
source§

impl<const LIMBS: usize> RemAssign<NonZero<Uint<LIMBS>>> for Uint<LIMBS>

source§

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

Performs the %= operation. Read more
source§

impl<const LIMBS: usize> Serialize for Uint<LIMBS>where Uint<LIMBS>: Encoding,

Available on crate feature serde only.
source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>where S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<const LIMBS: usize> Shl<usize> for &Uint<LIMBS>

source§

fn shl(self, rhs: usize) -> Uint<LIMBS>

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

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

§

type Output = Uint<LIMBS>

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

impl<const LIMBS: usize> Shl<usize> for Uint<LIMBS>

source§

fn shl(self, rhs: usize) -> Uint<LIMBS>

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

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

§

type Output = Uint<LIMBS>

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

impl<const LIMBS: usize> ShlAssign<usize> for Uint<LIMBS>

source§

fn shl_assign(&mut self, rhs: usize)

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

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

source§

impl<const LIMBS: usize> Shr<usize> for &Uint<LIMBS>

source§

fn shr(self, rhs: usize) -> Uint<LIMBS>

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

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

§

type Output = Uint<LIMBS>

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

impl<const LIMBS: usize> Shr<usize> for Uint<LIMBS>

source§

fn shr(self, rhs: usize) -> Uint<LIMBS>

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

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

§

type Output = Uint<LIMBS>

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

impl<const LIMBS: usize> ShrAssign<usize> for Uint<LIMBS>

source§

fn shr_assign(&mut self, rhs: usize)

Performs the >>= operation. Read more
source§

impl Split<Uint<{nlimbs!($bits)}>> for U1024

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U128

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U1280

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U1536

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U1792

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U2048

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U256

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U3072

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U3584

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U384

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U4096

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U512

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U6144

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U640

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U768

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U8192

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl Split<Uint<{nlimbs!($bits)}>> for U896

§

type Output = Uint<{nlimbs!($bits) / 2}>

Split output: high/low components of the value.
source§

fn split(&self) -> (Self::Output, Self::Output)

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

impl<const LIMBS: usize> SubMod<Uint<LIMBS>> for Uint<LIMBS>

§

type Output = Uint<LIMBS>

Output type.
source§

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

Compute self - rhs mod p. Read more
source§

impl<'a, const LIMBS: usize> TryFrom<AnyRef<'a>> for Uint<LIMBS>where Uint<LIMBS>: ArrayEncoding,

Available on crate features der and generic-array only.
§

type Error = Error

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

fn try_from(any: AnyRef<'a>) -> Result<Uint<LIMBS>>

Performs the conversion.
source§

impl<'a, const LIMBS: usize> TryFrom<UintRef<'a>> for Uint<LIMBS>where Uint<LIMBS>: ArrayEncoding,

Available on crate features der and generic-array only.
§

type Error = Error

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

fn try_from(bytes: UintRef<'a>) -> Result<Uint<LIMBS>>

Performs the conversion.
source§

impl<const LIMBS: usize> UpperHex for Uint<LIMBS>

source§

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

Formats the value using the given formatter.
source§

impl<const LIMBS: usize> Zero for Uint<LIMBS>

source§

const ZERO: Self = Self::ZERO

The value 0.
source§

fn is_zero(&self) -> Choice

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

impl<const LIMBS: usize> Copy for Uint<LIMBS>

source§

impl<const LIMBS: usize> DefaultIsZeroes for Uint<LIMBS>

Available on crate feature zeroize only.
source§

impl<const LIMBS: usize> Eq for Uint<LIMBS>

Auto Trait Implementations§

§

impl<const LIMBS: usize> RefUnwindSafe for Uint<LIMBS>

§

impl<const LIMBS: usize> Send for Uint<LIMBS>

§

impl<const LIMBS: usize> Sync for Uint<LIMBS>

§

impl<const LIMBS: usize> Unpin for Uint<LIMBS>

§

impl<const LIMBS: usize> UnwindSafe for Uint<LIMBS>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<'a, T> Choice<'a> for Twhere T: Decode<'a> + FixedTag,

source§

fn can_decode(tag: Tag) -> bool

Is the provided Tag decodable as a variant of this CHOICE?
source§

impl<'a, T> Decode<'a> for Twhere T: DecodeValue<'a> + FixedTag,

source§

fn decode<R>(reader: &mut R) -> Result<T, Error>where R: Reader<'a>,

Attempt to decode this message using the provided decoder.
source§

fn from_der(bytes: &'a [u8]) -> Result<Self, Error>

Parse Self from the provided DER-encoded byte slice.
source§

impl<T> Encode for Twhere T: EncodeValue + Tagged,

source§

fn encoded_len(&self) -> Result<Length, Error>

Compute the length of this value in bytes when encoded as ASN.1 DER.

source§

fn encode(&self, writer: &mut impl Writer) -> Result<(), Error>

Encode this value as ASN.1 DER using the provided Writer.

source§

fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>

Encode this value to the provided byte slice, returning a sub-slice containing the encoded message.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> Tagged for Twhere T: FixedTag,

source§

fn tag(&self) -> Tag

Get the ASN.1 tag that this type is encoded with.
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

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

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

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

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

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

§

type Error = Infallible

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

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

Performs the conversion.
source§

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

§

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

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

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

Performs the conversion.
source§

impl<Z> Zeroize for Zwhere Z: DefaultIsZeroes,

source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
source§

impl<T> DecodeOwned for Twhere T: for<'a> Decode<'a>,

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,