Expand description
Modular arithmetic support.
This module provides support for various modular arithmetic operations, implemented in terms of Montgomery form.
§Constant moduli
The ConstMontyForm and ConstMontyParams types implement support for modular arithmetic
where the modulus is fixed at compile-time.
The const_monty_params! macro can be used to define Montgomery
parameters at compile-time from a modulus, whereas the const_monty_form!
macro can define a ConstMontyForm constant.
§Dynamic moduli chosen at runtime
The FixedMontyForm and FixedMontyParams types implement support for modular arithmetic where
the modulus can vary at runtime.
Structs§
- Const
Monty Form - An integer in Montgomery form modulo
MOD, represented usingLIMBSlimbs. The modulus is constant, so it cannot be set at runtime. - Fixed
Monty Form - An integer in Montgomery form represented using
LIMBSlimbs. The odd modulus is set at runtime. - Monty
Params - Parameters to efficiently go to/from the Montgomery form for an odd modulus provided at runtime.
- Prime
Params - Parameters for supporting efficient computations on integers in Montgomery form with a prime modulus.
Traits§
- Const
Monty Params - Trait representing a modulus and its associated constants for converting in and out of Montgomery form.
- Const
Prime Monty Params - Trait representing a prime modulus and its associated constants for converting in and out of Montgomery form.
- Retrieve
- A generalization for numbers kept in optimized representations (e.g. Montgomery) that can be converted back to the original form.
Type Aliases§
- Fixed
Monty Params - Parameters to efficiently go to/from the Montgomery form for an odd modulus provided at runtime.