Add Pallas and Vesta curves (#21)

Co-authored-by: Ying Tong Lai <yingtong@electriccoin.co>
Co-authored-by: Daira Hopwood <daira@jacaranda.org>
Co-authored-by: Pratyush Mishra <pratyushmishra@berkeley.edu>
Co-authored-by: therealyingtong <yingtong@z.cash>
This commit is contained in:
Daira Hopwood
2020-12-31 00:56:00 +00:00
committed by GitHub
parent e7d7d01a02
commit 39c58df3a6
25 changed files with 840 additions and 10 deletions

1
vesta/src/fields/fq.rs Normal file
View File

@@ -0,0 +1 @@
pub use ark_pallas::{Fr as Fq, FrParameters as FqParameters};

1
vesta/src/fields/fr.rs Normal file
View File

@@ -0,0 +1 @@
pub use ark_pallas::{Fq as Fr, FqParameters as FrParameters};

8
vesta/src/fields/mod.rs Normal file
View File

@@ -0,0 +1,8 @@
pub mod fq;
pub use self::fq::*;
pub mod fr;
pub use self::fr::*;
#[cfg(test)]
mod tests;

26
vesta/src/fields/tests.rs Normal file
View File

@@ -0,0 +1,26 @@
use ark_std::test_rng;
use rand::Rng;
use crate::*;
use ark_curve_tests::fields::*;
#[test]
fn test_fr() {
let mut rng = test_rng();
let a: Fr = rng.gen();
let b: Fr = rng.gen();
field_test(a, b);
sqrt_field_test(a);
primefield_test::<Fr>();
}
#[test]
fn test_fq() {
let mut rng = test_rng();
let a: Fq = rng.gen();
let b: Fq = rng.gen();
field_test(a, b);
sqrt_field_test(a);
primefield_test::<Fq>();
}