Skip to main content

Module modular

Module modular 

Source
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§

ConstMontyForm
An integer in Montgomery form modulo MOD, represented using LIMBS limbs. The modulus is constant, so it cannot be set at runtime.
FixedMontyForm
An integer in Montgomery form represented using LIMBS limbs. The odd modulus is set at runtime.
MontyParams
Parameters to efficiently go to/from the Montgomery form for an odd modulus provided at runtime.
PrimeParams
Parameters for supporting efficient computations on integers in Montgomery form with a prime modulus.

Traits§

ConstMontyParams
Trait representing a modulus and its associated constants for converting in and out of Montgomery form.
ConstPrimeMontyParams
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§

FixedMontyParams
Parameters to efficiently go to/from the Montgomery form for an odd modulus provided at runtime.