halo2curves/pluto_eris/
fq.rs

1use core::convert::TryInto;
2
3use halo2derive::impl_field;
4use rand::RngCore;
5use subtle::{Choice, ConditionallySelectable, ConstantTimeEq, CtOption};
6
7impl_field!(
8    pluto_eris_fq,
9    Fq,
10    modulus = "24000000000024000130e0000d7f70e4a803ca76f439266f443f9a5c7a8a6c7be4a775fe8e177fd69ca7e85d60050af41ffffcd300000001",
11    mul_gen = "7",
12    zeta = "9000000000006c000392a0001afee1c9500792ae3039253e641ba35817a29ffaf50be000032cfffffffe",
13    from_uniform = [64, 72, 112],
14    endian = "little",
15);
16
17crate::extend_field_legendre!(Fq);
18crate::impl_binops_calls!(Fq);
19crate::impl_binops_additive!(Fq, Fq);
20crate::impl_binops_multiplicative!(Fq, Fq);
21crate::field_bits!(Fq);
22crate::serialize_deserialize_primefield!(Fq);
23crate::impl_from_u64!(Fq);
24crate::impl_from_bool!(Fq);
25
26#[cfg(test)]
27mod test {
28    use super::Fq;
29    use crate::{
30        arith_test, constants_test, from_uniform_bytes_test, legendre_test, serde_test, test,
31    };
32
33    constants_test!(Fq);
34
35    arith_test!(Fq);
36    legendre_test!(Fq);
37    test!(arith, Fq, sqrt_test, 1000);
38
39    serde_test!(Fq PrimeFieldBits);
40    from_uniform_bytes_test!(Fq, 1000, L 64, L 72, L 112);
41}