Module constant_mod

Module constant_mod 

Source
Expand description

Implements Residues, supporting modular arithmetic with a constant modulus.

Re-exportsยง

pub use macros::*;

Modulesยง

const_add ๐Ÿ”’
Additions between residues with a constant modulus
const_inv ๐Ÿ”’
Multiplicative inverses of residues with a constant modulus
const_mul ๐Ÿ”’
Multiplications between residues with a constant modulus
const_neg ๐Ÿ”’
Negations of residues with a constant modulus
const_pow ๐Ÿ”’
Exponentiation of residues with a constant modulus
const_sub ๐Ÿ”’
Subtractions between residues with a constant modulus
macros ๐Ÿ”’
Macros to remove the boilerplate code when dealing with constant moduli.

Structsยง

Residue
A residue mod MOD, represented using LIMBS limbs. The modulus of this residue is constant, so it cannot be set at runtime. Internally, the value is stored in Montgomery form (multiplied by MOD::R) until it is retrieved.

Traitsยง

ResidueParams
The parameters to efficiently go to and from the Montgomery form for a given odd modulus. An easy way to generate these parameters is using the impl_modulus! macro. These parameters are constant, so they cannot be set at runtime.