mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-04 20:03:39 +00:00
26 lines
562 B
Rust
26 lines
562 B
Rust
//! This module contains implementations for the two finite fields of the Pallas
|
|
//! and Vesta curves.
|
|
|
|
mod fp;
|
|
mod fq;
|
|
|
|
pub use fp::*;
|
|
pub use fq::*;
|
|
|
|
#[cfg(test)]
|
|
use ff::{Field, PrimeField};
|
|
|
|
#[cfg(test)]
|
|
use crate::arithmetic::FieldExt;
|
|
|
|
#[test]
|
|
fn test_extract() {
|
|
let a = Fq::rand();
|
|
let a = a.square();
|
|
let (t, s) = a.extract_radix2_vartime().unwrap();
|
|
assert_eq!(
|
|
t.pow_vartime(&[1 << Fq::S, 0, 0, 0]) * Fq::ROOT_OF_UNITY.pow_vartime(&[s, 0, 0, 0]),
|
|
a
|
|
);
|
|
assert_eq!(a.deterministic_sqrt().unwrap().square(), a);
|
|
}
|