mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-03 19:53:40 +00:00
Move Pasta implementations into root
This commit is contained in:
parent
b36356667f
commit
d40ed36d50
11 changed files with 27 additions and 31 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
use criterion::{criterion_group, criterion_main, Criterion};
|
use criterion::{criterion_group, criterion_main, Criterion};
|
||||||
|
|
||||||
use pasta_curves::arithmetic::CurveExt;
|
use pasta_curves::arithmetic::CurveExt;
|
||||||
use pasta_curves::pasta::{pallas, vesta};
|
use pasta_curves::{pallas, vesta};
|
||||||
|
|
||||||
fn criterion_benchmark(c: &mut Criterion) {
|
fn criterion_benchmark(c: &mut Criterion) {
|
||||||
bench_hash_to_curve(c);
|
bench_hash_to_curve(c);
|
||||||
|
|
|
||||||
23
src/lib.rs
23
src/lib.rs
|
|
@ -17,5 +17,26 @@
|
||||||
#![deny(missing_docs)]
|
#![deny(missing_docs)]
|
||||||
#![deny(unsafe_code)]
|
#![deny(unsafe_code)]
|
||||||
|
|
||||||
|
#[macro_use]
|
||||||
|
mod macros;
|
||||||
|
mod curves;
|
||||||
|
mod fields;
|
||||||
|
|
||||||
pub mod arithmetic;
|
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());
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -100,8 +100,8 @@ fn test_iso_map_identity() {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_map_to_curve_simple_swu() {
|
fn test_map_to_curve_simple_swu() {
|
||||||
use crate::arithmetic::CurveExt;
|
use crate::arithmetic::CurveExt;
|
||||||
use crate::pasta::curves::IsoEp;
|
use crate::curves::IsoEp;
|
||||||
use crate::pasta::hashtocurve::map_to_curve_simple_swu;
|
use crate::hashtocurve::map_to_curve_simple_swu;
|
||||||
|
|
||||||
// The zero input is a special case.
|
// The zero input is a special case.
|
||||||
let p: IsoEp = map_to_curve_simple_swu::<Fp, Ep, IsoEp>(&Fp::zero(), Ep::THETA, Ep::Z);
|
let p: IsoEp = map_to_curve_simple_swu::<Fp, Ep, IsoEp>(&Fp::zero(), Ep::THETA, Ep::Z);
|
||||||
25
src/pasta.rs
25
src/pasta.rs
|
|
@ -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());
|
|
||||||
}
|
|
||||||
|
|
@ -17,8 +17,8 @@ pub type Affine = EqAffine;
|
||||||
#[test]
|
#[test]
|
||||||
fn test_map_to_curve_simple_swu() {
|
fn test_map_to_curve_simple_swu() {
|
||||||
use crate::arithmetic::CurveExt;
|
use crate::arithmetic::CurveExt;
|
||||||
use crate::pasta::curves::IsoEq;
|
use crate::curves::IsoEq;
|
||||||
use crate::pasta::hashtocurve::map_to_curve_simple_swu;
|
use crate::hashtocurve::map_to_curve_simple_swu;
|
||||||
|
|
||||||
// The zero input is a special case.
|
// The zero input is a special case.
|
||||||
let p: IsoEq = map_to_curve_simple_swu::<Fq, Eq, IsoEq>(&Fq::zero(), Eq::THETA, Eq::Z);
|
let p: IsoEq = map_to_curve_simple_swu::<Fq, Eq, IsoEq>(&Fq::zero(), Eq::THETA, Eq::Z);
|
||||||
Loading…
Reference in a new issue