mina_curves/pasta/fields/
mod.rs1use ark_ff::Field;
2pub mod fp;
3pub use self::fp::*;
4
5pub mod fq;
6pub use self::fq::*;
7
8pub mod fft;
9
10#[derive(Debug, PartialEq)]
11pub enum LegendreSymbol {
12 Zero = 0,
13 QuadraticResidue = 1,
14 QuadraticNonResidue = -1,
15}
16
17impl LegendreSymbol {
18 pub fn is_zero(&self) -> bool {
19 *self == LegendreSymbol::Zero
20 }
21
22 pub fn is_qnr(&self) -> bool {
23 *self == LegendreSymbol::QuadraticNonResidue
24 }
25
26 pub fn is_qr(&self) -> bool {
27 *self == LegendreSymbol::QuadraticResidue
28 }
29}
30
31pub trait SquareRootField: Field {
33 fn legendre(&self) -> LegendreSymbol;
38
39 #[must_use]
41 fn sqrt(&self) -> Option<Self>;
42
43 fn sqrt_in_place(&mut self) -> Option<&mut Self>;
45}