pasta_curves-source/src/lib.rs
Jack Grigg 9999964d17 Add no-std support
We re-introduce the Tonelli-Shank square root algoritm that was removed
in zcash/halo2#120, to use in no-std mode (the table-based impl requires
allocations, and also uses 29kiB of memory which is a problem for
constrained environments that typically need no-std).
2021-09-20 18:56:23 +01:00

43 lines
920 B
Rust

//! Implementation of the Pallas / Vesta curve cycle.
#![no_std]
#![cfg_attr(docsrs, feature(doc_cfg))]
#![allow(unknown_lints)]
#![allow(clippy::op_ref, clippy::same_item_push, clippy::upper_case_acronyms)]
#![deny(broken_intra_doc_links)]
#![deny(missing_debug_implementations)]
#![deny(missing_docs)]
#![deny(unsafe_code)]
#[cfg(any(feature = "std", test))]
#[macro_use]
extern crate std;
#[macro_use]
mod macros;
mod curves;
mod fields;
pub mod arithmetic;
pub mod pallas;
pub mod vesta;
#[cfg(feature = "std")]
mod hashtocurve;
pub use curves::*;
pub use fields::*;
pub extern crate group;
#[cfg(feature = "std")]
#[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());
}