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, Eq)]
11pub enum LegendreSymbol {
12 Zero = 0,
13 QuadraticResidue = 1,
14 QuadraticNonResidue = -1,
15}
16
17impl LegendreSymbol {
18 #[must_use]
19 pub fn is_zero(&self) -> bool {
20 *self == Self::Zero
21 }
22
23 #[must_use]
24 pub fn is_qnr(&self) -> bool {
25 *self == Self::QuadraticNonResidue
26 }
27
28 #[must_use]
29 pub fn is_qr(&self) -> bool {
30 *self == Self::QuadraticResidue
31 }
32}
33
34pub trait SquareRootField: Field {
36 fn legendre(&self) -> LegendreSymbol;
41
42 #[must_use]
44 fn sqrt(&self) -> Option<Self>;
45
46 fn sqrt_in_place(&mut self) -> Option<&mut Self>;
48}