Skip to main content

UInt

Struct UInt 

Source
pub struct UInt<const LIMBS: usize> { /* private fields */ }
Expand description

Big unsigned integer.

Generic over the given number of LIMBS

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 wrapping_add(&self, rhs: &Self) -> Self

Perform wrapping addition, discarding overflow.

Source

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

Perform checked addition, returning a CtOption which is_some only if the operation did not 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 and rhs are < p.

Source§

impl<const LIMBS: usize> UInt<LIMBS>

Source

pub fn is_zero(&self) -> Choice

Determine if this UInt is equal to zero.

§Returns

If zero, return Choice(1). Otherwise, return Choice(0).

Source

pub fn is_odd(&self) -> Choice

Is this UInt an odd number?

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

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_uint_array(arr: [Inner; LIMBS]) -> Self

Create a UInt from an array of the limb::Inner unsigned integer type.

Source

pub const fn to_uint_array(self) -> [Inner; LIMBS]

Create an array of limb::Inner unsigned integer type from a UInt.

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.

Source

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

Perform wrapping multiplication, discarding overflow.

Source

pub 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

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

Square self, returning a “wide” result.

Source§

impl<const LIMBS: usize> UInt<LIMBS>

Source

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

Computes -a mod p in constant time.

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§

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 wrapping_sub(&self, rhs: &Self) -> Self

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

Source

pub fn checked_sub(&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> 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 and rhs are < p.

Source§

impl<const LIMBS: usize> UInt<LIMBS>

Source

pub fn random(rng: impl CryptoRng + RngCore) -> Self

Generate a cryptographically secure random UInt.

Source

pub fn random_mod(rng: impl CryptoRng + RngCore, modulus: &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 CryptoRng 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 CryptoRng, where previous outputs are unrelated to subsequent outputs and do not reveal information about the RNG’s internal state.

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 fn new(limbs: [Limb; LIMBS]) -> Self

Const-friendly UInt constructor.

Source

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

Borrow the limbs of this UInt.

Source

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

Convert this UInt into its inner limbs.

Trait Implementations§

Source§

impl AddMod for UInt<1>

Source§

type Output = UInt<1>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<2>

Source§

type Output = UInt<2>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<3>

Source§

type Output = UInt<3>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<4>

Source§

type Output = UInt<4>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<5>

Source§

type Output = UInt<5>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<6>

Source§

type Output = UInt<6>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<7>

Source§

type Output = UInt<7>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<8>

Source§

type Output = UInt<8>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<9>

Source§

type Output = UInt<9>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<10>

Source§

type Output = UInt<10>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<11>

Source§

type Output = UInt<11>

Output type.
Source§

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

Compute self + rhs mod p. Read more
Source§

impl AddMod for UInt<12>

Source§

type Output = UInt<12>

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> 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> Clone for UInt<LIMBS>

Source§

fn clone(&self) -> Self

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<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> Copy for UInt<LIMBS>

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> Default for UInt<LIMBS>

Source§

fn default() -> Self

Returns the “default value” for a type. 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> Eq for UInt<LIMBS>

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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (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: (U3072, U3072)) -> 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<const LIMBS: usize> From<Limb> for UInt<LIMBS>

Source§

fn from(limb: Limb) -> Self

Converts to this type from the input type.
Source§

impl<const LIMBS: usize> From<UInt<LIMBS>> for [Inner; LIMBS]

Source§

fn from(n: UInt<LIMBS>) -> [Inner; LIMBS]

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 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 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 (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: U192) -> (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: U384) -> (UInt<{ _ }>, UInt<{ _ }>)

Converts to this type from the input type.
Source§

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

Source§

fn from(num: U448) -> (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: U768) -> (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: U1024) -> (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: U1792) -> (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: U3072) -> (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: U6144) -> (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<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: [Inner; LIMBS]) -> 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> 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<u128> for UInt<LIMBS>

Source§

fn from(n: u128) -> 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> LowerHex for UInt<LIMBS>

Source§

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

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

impl NegMod for UInt<1>

Source§

type Output = UInt<1>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<2>

Source§

type Output = UInt<2>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<3>

Source§

type Output = UInt<3>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<4>

Source§

type Output = UInt<4>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<5>

Source§

type Output = UInt<5>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<6>

Source§

type Output = UInt<6>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<7>

Source§

type Output = UInt<7>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<8>

Source§

type Output = UInt<8>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<9>

Source§

type Output = UInt<9>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<10>

Source§

type Output = UInt<10>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<11>

Source§

type Output = UInt<11>

Output type.
Source§

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

Compute -self mod p.
Source§

impl NegMod for UInt<12>

Source§

type Output = UInt<12>

Output type.
Source§

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

Compute -self mod p.
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 (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§

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

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

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<const LIMBS: usize> PartialOrd 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 (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<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.

Source§

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.

Source§

type Output = UInt<LIMBS>

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

impl SubMod for UInt<1>

Source§

type Output = UInt<1>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<2>

Source§

type Output = UInt<2>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<3>

Source§

type Output = UInt<3>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<4>

Source§

type Output = UInt<4>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<5>

Source§

type Output = UInt<5>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<6>

Source§

type Output = UInt<6>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<7>

Source§

type Output = UInt<7>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<8>

Source§

type Output = UInt<8>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<9>

Source§

type Output = UInt<9>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<10>

Source§

type Output = UInt<10>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<11>

Source§

type Output = UInt<11>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl SubMod for UInt<12>

Source§

type Output = UInt<12>

Output type.
Source§

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

Compute self - rhs mod p. Read more
Source§

impl<const LIMBS: usize> UpperHex 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> Zeroize for UInt<LIMBS>

Available on crate feature zeroize only.
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.

Auto Trait Implementations§

§

impl<const LIMBS: usize> Freeze for UInt<LIMBS>

§

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> UnsafeUnpin for UInt<LIMBS>

§

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

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

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

Source§

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

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.