Expand description
Implements Residues, supporting modular arithmetic with a constant modulus.
Macros§
- const_
residue - Creates a
Residuewith the given value for a specific modulus. For example,residue!(U256::from(105u64), MyModulus);creates aResiduefor 105 modMyModulus. The modulus must be odd, or this will panic. - impl_
modulus - Implements a modulus with the given name, type, and value, in that specific order. Please
use crypto_bigint::traits::Encodingto make this work. For example,impl_modulus!(MyModulus, U256, "73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001");implements a 256-bit modulus namedMyModulus. The modulus must be odd, or this will panic.
Structs§
- Residue
- A residue mod
MOD, represented usingLIMBSlimbs. 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§
- Residue
Params - 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.