halo2curves_axiom/ff_ext/
mod.rs
1pub mod inverse;
2pub mod jacobi;
3use subtle::{Choice, ConstantTimeEq};
4
5pub trait Legendre {
6 fn legendre(&self) -> i64;
7
8 #[inline(always)]
9 fn ct_quadratic_non_residue(&self) -> Choice {
10 self.legendre().ct_eq(&-1)
11 }
12
13 #[inline(always)]
14 fn ct_quadratic_residue(&self) -> Choice {
15 self.legendre().ct_ne(&-1)
19 }
20}
21
22#[macro_export]
23macro_rules! extend_field_legendre {
24 ($field:ident ) => {
25 impl $crate::ff_ext::Legendre for $field {
26 #[inline(always)]
27 fn legendre(&self) -> i64 {
28 self.jacobi()
29 }
30 }
31 };
32}