Macro scuttlebutt::prime_field_using_ff
source · [−]macro_rules! prime_field_using_ff {
(
$(#[$m: meta])*
$name: ident,
$mod_name: ident,
modulus = $modulus: expr,
generator = $generator: expr,
limbs = $limbs: expr,
actual_limbs = $actual_limbs: expr,
num_bytes = $num_bytes: ty,
num_bits = $num_bits: ty,
$(single_limb_modulus = $single_limb_modulus: expr)?
) => { ... };
}
Expand description
This macro constructs a prime finite field using the ff
library.
The modulus and generator should be listed, along with the name, in build.rs
.
$name
: The name of the field.$mod_name
: The name of the module containing the field.$modulus
: The prime modulus, given as a string.$generator
: The multiplicative generator, given as a string.$limbs
: The number ofu64
s required to fit values of size$modulus * 2
(where the* 2
requirement comes from theff
library).$actual_limbs
: The number ofu64
s required to fit values of size$modulus
. This’ll generally be the same as$limbs
except in certain edge cases where$modulus * 2
overflows[u64; $actual_limbs]
.$num_bytes
: The number of bytes required to store$modulus
, given as ageneric_array::typenum
.$num_bits
: The number of bits required to store$modulus
, given as ageneric_array::typenum
.- [Optional]
$single_limb_modulus
: If$limbs
is one, then this can contain$modulus
(given as an integer not a string!) to enable faster random value generation.