[−][src]Macro gridiron::fp31
Create an Fp type given the following parameters:
- modname - the name of the module you want the Fp type in.
- classname - the name of the Fp struct
- bits - How many bits the prime is.
- limbs - Number of limbs (ceil(bits/31))
- prime - prime number in limbs, least significant digit first. (Note you can get this from
sage
usingnum.digits(2 ^ 31)
). - barrett - barrett reduction for reducing values up to twice the number of prime bits (double limbs). This is
floor(2^(31*numlimbs*2)/prime)
. - montgomery_r_inv - R = 2^(W*N) where W = word size and N = limbs. Then calculate R^-1 mod p. See lib.rs for examples.
- montgomery_r_squared - The above R should be used in this as well. R^2 mod prime
- m0_inv - The first element of the prime negated, inverted and modded by our limb size (2^31). m0 = prime[0]; (-m0).inverse_mod(2^31)