Move Pasta implementations into root

This commit is contained in:
Jack Grigg 2021-03-03 21:51:54 +00:00
parent b36356667f
commit d40ed36d50
11 changed files with 27 additions and 31 deletions

View File

@ -3,7 +3,7 @@
use criterion::{criterion_group, criterion_main, Criterion};
use pasta_curves::arithmetic::CurveExt;
use pasta_curves::pasta::{pallas, vesta};
use pasta_curves::{pallas, vesta};
fn criterion_benchmark(c: &mut Criterion) {
bench_hash_to_curve(c);

View File

@ -17,5 +17,26 @@
#![deny(missing_docs)]
#![deny(unsafe_code)]
#[macro_use]
mod macros;
mod curves;
mod fields;
pub mod arithmetic;
pub mod pasta;
mod hashtocurve;
pub mod pallas;
pub mod vesta;
pub use curves::*;
pub use fields::*;
#[test]
fn test_endo_consistency() {
use crate::arithmetic::{CurveExt, FieldExt};
use group::Group;
let a = pallas::Point::generator();
assert_eq!(a * pallas::Scalar::ZETA, a.endo());
let a = vesta::Point::generator();
assert_eq!(a * vesta::Scalar::ZETA, a.endo());
}

View File

@ -100,8 +100,8 @@ fn test_iso_map_identity() {
#[test]
fn test_map_to_curve_simple_swu() {
use crate::arithmetic::CurveExt;
use crate::pasta::curves::IsoEp;
use crate::pasta::hashtocurve::map_to_curve_simple_swu;
use crate::curves::IsoEp;
use crate::hashtocurve::map_to_curve_simple_swu;
// The zero input is a special case.
let p: IsoEp = map_to_curve_simple_swu::<Fp, Ep, IsoEp>(&Fp::zero(), Ep::THETA, Ep::Z);

View File

@ -1,25 +0,0 @@
//! This module contains implementations for the Pallas and Vesta elliptic curve
//! groups.
#[macro_use]
mod macros;
mod curves;
mod fields;
mod hashtocurve;
pub mod pallas;
pub mod vesta;
pub use curves::*;
pub use fields::*;
#[test]
fn test_endo_consistency() {
use crate::arithmetic::{CurveExt, FieldExt};
use group::Group;
let a = pallas::Point::generator();
assert_eq!(a * pallas::Scalar::ZETA, a.endo());
let a = vesta::Point::generator();
assert_eq!(a * vesta::Scalar::ZETA, a.endo());
}

View File

@ -17,8 +17,8 @@ pub type Affine = EqAffine;
#[test]
fn test_map_to_curve_simple_swu() {
use crate::arithmetic::CurveExt;
use crate::pasta::curves::IsoEq;
use crate::pasta::hashtocurve::map_to_curve_simple_swu;
use crate::curves::IsoEq;
use crate::hashtocurve::map_to_curve_simple_swu;
// The zero input is a special case.
let p: IsoEq = map_to_curve_simple_swu::<Fq, Eq, IsoEq>(&Fq::zero(), Eq::THETA, Eq::Z);