Skip to main content

Module traits

Module traits 

Source
Expand description

Traits provided by this crate

Modules§

sealed 🔒
Support for sealing traits defined in this module.

Enums§

RandomBitsError
Possible errors of the methods in RandomBits trait.

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 &.
BitAndAssign
The bitwise AND assignment operator &=.
BitOps
Bit counting and bit operations.
BitOr
The bitwise OR operator |.
BitOrAssign
The bitwise OR assignment operator |=.
BitXor
The bitwise XOR operator ^.
BitXorAssign
The bitwise XOR assignment operator ^=.
Bounded
Integers whose representation takes a bounded amount of space.
CheckedAdd
Checked addition.
CheckedDiv
Checked division.
CheckedMul
Checked multiplication.
CheckedSquareRoot
Support for calculating checked square roots.
CheckedSub
Checked subtraction.
Concat
Define the result of concatenating two numbers into a “wide” value.
ConcatenatingMul
Widening multiply: returns a value with a number of limbs equal to the sum of the inputs.
ConcatenatingSquare
Widening square: returns a value with a number of limbs equal to double the sum of the input.
ConstOne
Defines an associated constant representing the multiplicative identity element for Self.
ConstZero
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)Eq with Choice instead of bool.
CtGt
Constant time greater than.
CtLt
Constant time less than.
CtNeg
Constant-time conditional negation: negates a value when choice is Choice::TRUE.
CtSelect
Constant-time selection: choose between two values based on a given Choice.
Div
The division operator /.
DivAssign
The division assignment operator /=.
DivRemLimb
Support for optimized division by a single limb.
DivVartime
Division in variable time.
FixedInteger
Fixed-width Integers.
FloorSquareRoot
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.
InvModDeprecated
Compute 1 / self mod p.
Invert
Constant-time inversion.
InvertMod
Compute 1 / self mod p.
Lcm
Compute the least common multiple of two integers.
MontyForm
A representation of an integer optimized for the performance of modular operations.
MontyMultiplier
Prepared Montgomery multiplier for tight loops.
Mul
The multiplication operator *.
MulAssign
The multiplication assignment operator *=.
MulMod
Compute self * rhs mod p.
MultiExponentiate
Performs modular multi-exponentiation using Montgomery’s ladder.
MultiExponentiateBoundedExp
Performs modular multi-exponentiation using Montgomery’s ladder. exponent_bits represents 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.
PowBoundedExp
Constant-time exponentiation with exponent of a bounded bit size.
Random
Random number generation support.
RandomBits
Random bits generation support.
RandomMod
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 though a << b and a.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 though a >> b and a.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.
SplitEven
Define the result of splitting a number into two parts, with each part having an equal width.
Square
Support for optimized squaring
SquareAssign
Support for optimized squaring in-place
SquareMod
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 into Unsigned.
Unsigned
Unsigned Integers.
UnsignedWithMontyForm
Unsigned integers with an associated MontyForm.
WideningMulDeprecated
Widening multiply: returns a value with a number of limbs equal to the sum of the inputs.
WrappingAdd
Performs addition that wraps around on overflow.
WrappingMul
Performs multiplication that wraps around on overflow.
WrappingNeg
Performs a negation that does not panic.
WrappingShl
Performs a left shift that does not panic.
WrappingShr
Performs a right shift that does not panic.
WrappingSub
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.