Expand description
Traits provided by this crate
Modules§
- sealed 🔒
- Support for sealing traits defined in this module.
Enums§
- Random
Bits Error - Possible errors of the methods in
RandomBitstrait.
Traits§
- Add
- The addition operator
+. - AddAssign
- The addition assignment operator
+=. - AddMod
- Compute
self + rhs mod p. - AmmMultiplier 🔒
- Prepared Montgomery multiplier for tight loops, performing “Almost Montgomery Multiplication”.
- BitAnd
- The bitwise AND operator
&. - BitAnd
Assign - The bitwise AND assignment operator
&=. - BitOps
- Bit counting and bit operations.
- BitOr
- The bitwise OR operator
|. - BitOr
Assign - The bitwise OR assignment operator
|=. - BitXor
- The bitwise XOR operator
^. - BitXor
Assign - The bitwise XOR assignment operator
^=. - Bounded
- Integers whose representation takes a bounded amount of space.
- Checked
Add - Checked addition.
- Checked
Div - Checked division.
- Checked
Mul - Checked multiplication.
- Checked
Square Root - Support for calculating checked square roots.
- Checked
Sub - Checked subtraction.
- Concat
- Define the result of concatenating two numbers into a “wide” value.
- Concatenating
Mul - Widening multiply: returns a value with a number of limbs equal to the sum of the inputs.
- Concatenating
Square - Widening square: returns a value with a number of limbs equal to double the sum of the input.
- Const
One - Defines an associated constant representing the multiplicative identity
element for
Self. - Const
Zero - Defines an associated constant representing the additive identity element
for
Self. - Constants
- Trait for associating constant values with a type.
- CtAssign
- Constant-time conditional assignment: assign a given value to another based on a
Choice. - CtEq
- Constant-time equality: like
(Partial)EqwithChoiceinstead ofbool. - CtGt
- Constant time greater than.
- CtLt
- Constant time less than.
- CtNeg
- Constant-time conditional negation: negates a value when
choiceisChoice::TRUE. - CtSelect
- Constant-time selection: choose between two values based on a given
Choice. - Div
- The division operator
/. - DivAssign
- The division assignment operator
/=. - DivRem
Limb - Support for optimized division by a single limb.
- DivVartime
- Division in variable time.
- Fixed
Integer - Fixed-width
Integers. - Floor
Square Root - Support for calculating floored square roots.
- Gcd
- Compute the greatest common divisor of two integers.
- Integer
- Integer trait: represents common functionality of integer types provided by this crate.
- InvMod
Deprecated - Compute
1 / self mod p. - Invert
- Constant-time inversion.
- Invert
Mod - Compute
1 / self mod p. - Lcm
- Compute the least common multiple of two integers.
- Monty
Form - A representation of an integer optimized for the performance of modular operations.
- Monty
Multiplier - Prepared Montgomery multiplier for tight loops.
- Mul
- The multiplication operator
*. - MulAssign
- The multiplication assignment operator
*=. - MulMod
- Compute
self * rhs mod p. - Multi
Exponentiate - Performs modular multi-exponentiation using Montgomery’s ladder.
- Multi
Exponentiate Bounded Exp - Performs modular multi-exponentiation using Montgomery’s ladder.
exponent_bitsrepresents the number of bits to take into account for the exponent. - Neg
- The unary negation operator
-. - NegMod
- Compute
-self mod p. - Not
- The unary logical negation operator
!. - One
- One values: multiplicative identity element for
Self. - Pow
- Constant-time exponentiation.
- PowBounded
Exp - Constant-time exponentiation with exponent of a bounded bit size.
- Random
- Random number generation support.
- Random
Bits - Random bits generation support.
- Random
Mod - Modular random number generation support.
- Reduce
- Modular reduction from a larger value
T. - Rem
- The remainder operator
%. - RemAssign
- The remainder assignment operator
%=. - RemLimb
- Support for optimized division by a single limb.
- RemMixed
- Support for calculating the remainder of two differently sized integers.
- Resize
- Methods for resizing the allocated storage.
- Shl
- The left shift operator
<<. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ << _, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha << banda.shl(b)are one and the same from an evaluation standpoint, they are different when it comes to type inference. - ShlAssign
- The left shift assignment operator
<<=. - ShlVartime
- Left shifts, variable time in
shift. - Shr
- The right shift operator
>>. Note that because this trait is implemented for all integer types with multiple right-hand-side types, Rust’s type checker has special handling for_ >> _, setting the result type for integer operations to the type of the left-hand-side operand. This means that thougha >> banda.shr(b)are one and the same from an evaluation standpoint, they are different when it comes to type inference. - ShrAssign
- The right shift assignment operator
>>=. - ShrVartime
- Right shifts, variable time in
shift. - Signed
- Signed
Integers. - Split
- Define the result of splitting a number into two parts, with the
first part having the width
LO. - Split
Even - Define the result of splitting a number into two parts, with each part having an equal width.
- Square
- Support for optimized squaring
- Square
Assign - Support for optimized squaring in-place
- Square
Mod - Compute
self * self mod p. - Sub
- The subtraction operator
-. - SubAssign
- The subtraction assignment operator
-=. - SubMod
- Compute
self - rhs mod p. - ToUnsigned
- Support for upgrading
UintRef-compatible references intoUnsigned. - Unsigned
- Unsigned
Integers. - Unsigned
With Monty Form Unsignedintegers with an associatedMontyForm.- Widening
Mul Deprecated - Widening multiply: returns a value with a number of limbs equal to the sum of the inputs.
- Wrapping
Add - Performs addition that wraps around on overflow.
- Wrapping
Mul - Performs multiplication that wraps around on overflow.
- Wrapping
Neg - Performs a negation that does not panic.
- Wrapping
Shl - Performs a left shift that does not panic.
- Wrapping
Shr - Performs a right shift that does not panic.
- Wrapping
Sub - Performs subtraction that wraps around on overflow.
- Xgcd
- Compute the extended greatest common divisor of two integers.
- Zero
- Zero values: additive identity element for
Self.