mirror of
https://github.com/Qortal/pirate-librustzcash.git
synced 2025-02-14 18:55:47 +00:00
Update to latest rustfmt
This commit is contained in:
parent
e4143a4bbc
commit
da5f1d3e37
@ -1,8 +1,8 @@
|
|||||||
mod g1 {
|
mod g1 {
|
||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand::{Rand, SeedableRng, XorShiftRng};
|
||||||
|
|
||||||
use pairing::CurveProjective;
|
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
|
use pairing::CurveProjective;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_g1_mul_assign(b: &mut ::test::Bencher) {
|
fn bench_g1_mul_assign(b: &mut ::test::Bencher) {
|
||||||
@ -65,8 +65,8 @@ mod g1 {
|
|||||||
mod g2 {
|
mod g2 {
|
||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand::{Rand, SeedableRng, XorShiftRng};
|
||||||
|
|
||||||
use pairing::CurveProjective;
|
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
|
use pairing::CurveProjective;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_g2_mul_assign(b: &mut ::test::Bencher) {
|
fn bench_g2_mul_assign(b: &mut ::test::Bencher) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand::{Rand, SeedableRng, XorShiftRng};
|
||||||
|
|
||||||
use pairing::{Field, PrimeField, PrimeFieldRepr, SqrtField};
|
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
|
use pairing::{Field, PrimeField, PrimeFieldRepr, SqrtField};
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_fq_repr_add_nocarry(b: &mut ::test::Bencher) {
|
fn bench_fq_repr_add_nocarry(b: &mut ::test::Bencher) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand::{Rand, SeedableRng, XorShiftRng};
|
||||||
|
|
||||||
use pairing::Field;
|
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
|
use pairing::Field;
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_fq12_add_assign(b: &mut ::test::Bencher) {
|
fn bench_fq12_add_assign(b: &mut ::test::Bencher) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand::{Rand, SeedableRng, XorShiftRng};
|
||||||
|
|
||||||
use pairing::{Field, SqrtField};
|
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
|
use pairing::{Field, SqrtField};
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_fq2_add_assign(b: &mut ::test::Bencher) {
|
fn bench_fq2_add_assign(b: &mut ::test::Bencher) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand::{Rand, SeedableRng, XorShiftRng};
|
||||||
|
|
||||||
use pairing::{Field, PrimeField, PrimeFieldRepr, SqrtField};
|
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
|
use pairing::{Field, PrimeField, PrimeFieldRepr, SqrtField};
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_fr_repr_add_nocarry(b: &mut ::test::Bencher) {
|
fn bench_fr_repr_add_nocarry(b: &mut ::test::Bencher) {
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
mod fq;
|
|
||||||
mod fr;
|
|
||||||
mod fq2;
|
|
||||||
mod fq12;
|
|
||||||
mod ec;
|
mod ec;
|
||||||
|
mod fq;
|
||||||
|
mod fq12;
|
||||||
|
mod fq2;
|
||||||
|
mod fr;
|
||||||
|
|
||||||
use rand::{Rand, SeedableRng, XorShiftRng};
|
use rand::{Rand, SeedableRng, XorShiftRng};
|
||||||
|
|
||||||
use pairing::{CurveAffine, Engine};
|
|
||||||
use pairing::bls12_381::*;
|
use pairing::bls12_381::*;
|
||||||
|
use pairing::{CurveAffine, Engine};
|
||||||
|
|
||||||
#[bench]
|
#[bench]
|
||||||
fn bench_pairing_g1_preparation(b: &mut ::test::Bencher) {
|
fn bench_pairing_g1_preparation(b: &mut ::test::Bencher) {
|
||||||
|
@ -621,12 +621,14 @@ macro_rules! curve_impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub mod g1 {
|
pub mod g1 {
|
||||||
|
use super::super::{Bls12, Fq, Fq12, FqRepr, Fr, FrRepr};
|
||||||
|
use super::g2::G2Affine;
|
||||||
use rand::{Rand, Rng};
|
use rand::{Rand, Rng};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use super::g2::G2Affine;
|
use {
|
||||||
use super::super::{Bls12, Fq, Fq12, FqRepr, Fr, FrRepr};
|
BitIterator, CurveAffine, CurveProjective, EncodedPoint, Engine, Field, GroupDecodingError,
|
||||||
use {BitIterator, CurveAffine, CurveProjective, EncodedPoint, Engine, Field,
|
PrimeField, PrimeFieldRepr, SqrtField,
|
||||||
GroupDecodingError, PrimeField, PrimeFieldRepr, SqrtField};
|
};
|
||||||
|
|
||||||
curve_impl!(
|
curve_impl!(
|
||||||
"G1",
|
"G1",
|
||||||
@ -1266,12 +1268,14 @@ pub mod g1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub mod g2 {
|
pub mod g2 {
|
||||||
use rand::{Rand, Rng};
|
|
||||||
use std::fmt;
|
|
||||||
use super::super::{Bls12, Fq, Fq12, Fq2, FqRepr, Fr, FrRepr};
|
use super::super::{Bls12, Fq, Fq12, Fq2, FqRepr, Fr, FrRepr};
|
||||||
use super::g1::G1Affine;
|
use super::g1::G1Affine;
|
||||||
use {BitIterator, CurveAffine, CurveProjective, EncodedPoint, Engine, Field,
|
use rand::{Rand, Rng};
|
||||||
GroupDecodingError, PrimeField, PrimeFieldRepr, SqrtField};
|
use std::fmt;
|
||||||
|
use {
|
||||||
|
BitIterator, CurveAffine, CurveProjective, EncodedPoint, Engine, Field, GroupDecodingError,
|
||||||
|
PrimeField, PrimeFieldRepr, SqrtField,
|
||||||
|
};
|
||||||
|
|
||||||
curve_impl!(
|
curve_impl!(
|
||||||
"G2",
|
"G2",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use {Field, PrimeField, PrimeFieldDecodingError, PrimeFieldRepr, SqrtField};
|
|
||||||
use std::cmp::Ordering;
|
|
||||||
use super::fq2::Fq2;
|
use super::fq2::Fq2;
|
||||||
|
use std::cmp::Ordering;
|
||||||
|
use {Field, PrimeField, PrimeFieldDecodingError, PrimeFieldRepr, SqrtField};
|
||||||
|
|
||||||
// q = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787
|
// q = 4002409555221667393417789825735904156556882819939007885332058136124031650490837864442687629129015664037894272559787
|
||||||
const MODULUS: FqRepr = FqRepr([
|
const MODULUS: FqRepr = FqRepr([
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
use super::fq::FROBENIUS_COEFF_FQ12_C1;
|
||||||
|
use super::fq2::Fq2;
|
||||||
|
use super::fq6::Fq6;
|
||||||
use rand::{Rand, Rng};
|
use rand::{Rand, Rng};
|
||||||
use Field;
|
use Field;
|
||||||
use super::fq6::Fq6;
|
|
||||||
use super::fq2::Fq2;
|
|
||||||
use super::fq::FROBENIUS_COEFF_FQ12_C1;
|
|
||||||
|
|
||||||
/// An element of Fq12, represented by c0 + c1 * w.
|
/// An element of Fq12, represented by c0 + c1 * w.
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
use super::fq::{FROBENIUS_COEFF_FQ2_C1, Fq, NEGATIVE_ONE};
|
||||||
use rand::{Rand, Rng};
|
use rand::{Rand, Rng};
|
||||||
use {Field, SqrtField};
|
use {Field, SqrtField};
|
||||||
use super::fq::{FROBENIUS_COEFF_FQ2_C1, Fq, NEGATIVE_ONE};
|
|
||||||
|
|
||||||
use std::cmp::Ordering;
|
use std::cmp::Ordering;
|
||||||
|
|
||||||
@ -271,8 +271,8 @@ fn test_fq2_basics() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_squaring() {
|
fn test_fq2_squaring() {
|
||||||
use PrimeField;
|
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
|
use PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::one(),
|
c0: Fq::one(),
|
||||||
@ -345,8 +345,8 @@ fn test_fq2_squaring() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_mul() {
|
fn test_fq2_mul() {
|
||||||
use PrimeField;
|
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
|
use PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -409,8 +409,8 @@ fn test_fq2_mul() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_inverse() {
|
fn test_fq2_inverse() {
|
||||||
use PrimeField;
|
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
|
use PrimeField;
|
||||||
|
|
||||||
assert!(Fq2::zero().inverse().is_none());
|
assert!(Fq2::zero().inverse().is_none());
|
||||||
|
|
||||||
@ -458,8 +458,8 @@ fn test_fq2_inverse() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_addition() {
|
fn test_fq2_addition() {
|
||||||
use PrimeField;
|
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
|
use PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -522,8 +522,8 @@ fn test_fq2_addition() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_subtraction() {
|
fn test_fq2_subtraction() {
|
||||||
use PrimeField;
|
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
|
use PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -586,8 +586,8 @@ fn test_fq2_subtraction() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_negation() {
|
fn test_fq2_negation() {
|
||||||
use PrimeField;
|
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
|
use PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -633,8 +633,8 @@ fn test_fq2_negation() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_doubling() {
|
fn test_fq2_doubling() {
|
||||||
use PrimeField;
|
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
|
use PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -680,8 +680,8 @@ fn test_fq2_doubling() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_frobenius_map() {
|
fn test_fq2_frobenius_map() {
|
||||||
use PrimeField;
|
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
|
use PrimeField;
|
||||||
|
|
||||||
let mut a = Fq2 {
|
let mut a = Fq2 {
|
||||||
c0: Fq::from_repr(FqRepr([
|
c0: Fq::from_repr(FqRepr([
|
||||||
@ -793,8 +793,8 @@ fn test_fq2_frobenius_map() {
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_fq2_sqrt() {
|
fn test_fq2_sqrt() {
|
||||||
use PrimeField;
|
|
||||||
use super::fq::FqRepr;
|
use super::fq::FqRepr;
|
||||||
|
use PrimeField;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Fq2 {
|
Fq2 {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
|
use super::fq::{FROBENIUS_COEFF_FQ6_C1, FROBENIUS_COEFF_FQ6_C2};
|
||||||
|
use super::fq2::Fq2;
|
||||||
use rand::{Rand, Rng};
|
use rand::{Rand, Rng};
|
||||||
use Field;
|
use Field;
|
||||||
use super::fq2::Fq2;
|
|
||||||
use super::fq::{FROBENIUS_COEFF_FQ6_C1, FROBENIUS_COEFF_FQ6_C2};
|
|
||||||
|
|
||||||
/// An element of Fq6, represented by c0 + c1 * v + c2 * v^(2).
|
/// An element of Fq6, represented by c0 + c1 * v + c2 * v^(2).
|
||||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use {Field, PrimeField, PrimeFieldDecodingError, PrimeFieldRepr, SqrtField};
|
|
||||||
use LegendreSymbol::*;
|
use LegendreSymbol::*;
|
||||||
|
use {Field, PrimeField, PrimeFieldDecodingError, PrimeFieldRepr, SqrtField};
|
||||||
|
|
||||||
// r = 52435875175126190479447740508185965837690552500527637822603658699938581184513
|
// r = 52435875175126190479447740508185965837690552500527637822603658699938581184513
|
||||||
const MODULUS: FrRepr = FrRepr([
|
const MODULUS: FrRepr = FrRepr([
|
||||||
|
@ -1,20 +1,22 @@
|
|||||||
|
mod ec;
|
||||||
mod fq;
|
mod fq;
|
||||||
mod fr;
|
mod fq12;
|
||||||
mod fq2;
|
mod fq2;
|
||||||
mod fq6;
|
mod fq6;
|
||||||
mod fq12;
|
mod fr;
|
||||||
mod ec;
|
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
pub use self::fr::{Fr, FrRepr};
|
pub use self::ec::{
|
||||||
|
G1, G1Affine, G1Compressed, G1Prepared, G1Uncompressed, G2, G2Affine, G2Compressed, G2Prepared,
|
||||||
|
G2Uncompressed,
|
||||||
|
};
|
||||||
pub use self::fq::{Fq, FqRepr};
|
pub use self::fq::{Fq, FqRepr};
|
||||||
|
pub use self::fq12::Fq12;
|
||||||
pub use self::fq2::Fq2;
|
pub use self::fq2::Fq2;
|
||||||
pub use self::fq6::Fq6;
|
pub use self::fq6::Fq6;
|
||||||
pub use self::fq12::Fq12;
|
pub use self::fr::{Fr, FrRepr};
|
||||||
pub use self::ec::{G1, G1Affine, G1Compressed, G1Prepared, G1Uncompressed, G2, G2Affine,
|
|
||||||
G2Compressed, G2Prepared, G2Uncompressed};
|
|
||||||
|
|
||||||
use super::{BitIterator, CurveAffine, Engine, Field};
|
use super::{BitIterator, CurveAffine, Engine, Field};
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::*;
|
use super::*;
|
||||||
use ::*;
|
use *;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_pairing_result_against_relic() {
|
fn test_pairing_result_against_relic() {
|
||||||
|
@ -24,8 +24,8 @@ pub mod bls12_381;
|
|||||||
mod wnaf;
|
mod wnaf;
|
||||||
pub use self::wnaf::Wnaf;
|
pub use self::wnaf::Wnaf;
|
||||||
|
|
||||||
use std::fmt;
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
|
use std::fmt;
|
||||||
use std::io::{self, Read, Write};
|
use std::io::{self, Read, Write};
|
||||||
|
|
||||||
/// An "engine" is a collection of types (fields, elliptic curve groups, etc.)
|
/// An "engine" is a collection of types (fields, elliptic curve groups, etc.)
|
||||||
|
@ -47,7 +47,8 @@ pub fn curve_tests<G: CurveProjective>() {
|
|||||||
{
|
{
|
||||||
let a = G::rand(&mut rng);
|
let a = G::rand(&mut rng);
|
||||||
let b = a.into_affine().into_projective();
|
let b = a.into_affine().into_projective();
|
||||||
let c = a.into_affine()
|
let c = a
|
||||||
|
.into_affine()
|
||||||
.into_projective()
|
.into_projective()
|
||||||
.into_affine()
|
.into_affine()
|
||||||
.into_projective();
|
.into_projective();
|
||||||
@ -372,7 +373,8 @@ fn random_transformation_tests<G: CurveProjective>() {
|
|||||||
v[s] = v[s].into_affine().into_projective();
|
v[s] = v[s].into_affine().into_projective();
|
||||||
}
|
}
|
||||||
|
|
||||||
let expected_v = v.iter()
|
let expected_v = v
|
||||||
|
.iter()
|
||||||
.map(|v| v.into_affine().into_projective())
|
.map(|v| v.into_affine().into_projective())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
G::batch_normalization(&mut v);
|
G::batch_normalization(&mut v);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
pub mod curve;
|
pub mod curve;
|
||||||
pub mod field;
|
|
||||||
pub mod engine;
|
pub mod engine;
|
||||||
|
pub mod field;
|
||||||
pub mod repr;
|
pub mod repr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user