ark_bls12_377/fields/fr.rs
1//! Bls12-377 scalar field.
2/// Roots of unity computed from modulus and R using this sage code:
3///
4/// ```ignore
5/// q = 8444461749428370424248824938781546531375899335154063827935233455917409239041
6/// R = 6014086494747379908336260804527802945383293308637734276299549080986809532403 # Montgomery R
7/// s = 47
8/// o = q - 1
9/// F = GF(q)
10/// g = F.multiplicative_generator()
11/// g = F.multiplicative_generator()
12/// assert g.multiplicative_order() == o
13/// g2 = g ** (o/2**s)
14/// assert g2.multiplicative_order() == 2**s
15/// def into_chunks(val, width, n):
16/// return [int(int(val) // (2 ** (width * i)) % 2 ** width) for i in range(n)]
17/// print("Gen: ", g * R % q)
18/// print("Gen: ", into_chunks(g * R % q, 64, 4))
19/// print("2-adic gen: ", into_chunks(g2 * R % q, 64, 4))
20/// ```
21use ark_ff::fields::{Fp256, MontBackend, MontConfig};
22
23#[derive(MontConfig)]
24#[modulus = "8444461749428370424248824938781546531375899335154063827935233455917409239041"]
25#[generator = "22"]
26pub struct FrConfig;
27pub type Fr = Fp256<MontBackend<FrConfig, 4>>;