Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back curve algorithms for a = 0 #82

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions benches/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@ fn criterion_benchmark<G: CurveExt>(c: &mut Criterion) {
let v = vec![G::generator(); N];
let mut q = vec![G::AffineExt::identity(); N];

c.bench_function(&format!("{} check on curve", name), move |b| {
c.bench_function(&format!("{name} check on curve"), move |b| {
b.iter(|| black_box(p1).is_on_curve())
});
c.bench_function(&format!("{} check equality", name), move |b| {
c.bench_function(&format!("{name} check equality"), move |b| {
b.iter(|| black_box(p1) == black_box(p1))
});
c.bench_function(&format!("{} to affine", name), move |b| {
c.bench_function(&format!("{name} to affine"), move |b| {
b.iter(|| G::AffineExt::from(black_box(p1)))
});
c.bench_function(&format!("{} doubling", name), move |b| {
c.bench_function(&format!("{name} doubling"), move |b| {
b.iter(|| black_box(p1).double())
});
c.bench_function(&format!("{} addition", name), move |b| {
c.bench_function(&format!("{name} addition"), move |b| {
b.iter(|| black_box(p1).add(&p2))
});
c.bench_function(&format!("{} mixed addition", name), move |b| {
c.bench_function(&format!("{name} mixed addition"), move |b| {
b.iter(|| black_box(p2).add(&p1_affine))
});
c.bench_function(&format!("{} scalar multiplication", name), move |b| {
c.bench_function(&format!("{name} scalar multiplication"), move |b| {
b.iter(|| black_box(p1) * black_box(s))
});
c.bench_function(&format!("{} batch to affine n={}", name, N), move |b| {
c.bench_function(&format!("{name} batch to affine n={N}"), move |b| {
b.iter(|| {
G::batch_normalize(black_box(&v), black_box(&mut q));
black_box(&q)[0]
Expand Down
2 changes: 1 addition & 1 deletion benches/hash_to_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn hash_to_curve<G: CurveExt>(c: &mut Criterion, name: &'static str) {
.flatten()
.collect::<Vec<_>>();

c.bench_function(&format!("Hash to {}", name), move |b| {
c.bench_function(&format!("Hash to {name}"), move |b| {
b.iter(|| hasher(black_box(&message)))
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/bn256/fq2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ impl Legendre for Fq2 {
static ref LEGENDRE_EXP: Vec<u64> =
(num_bigint::BigUint::from_bytes_le((-<Fq as ff::Field>::ONE).to_repr().as_ref())/2usize).to_u64_digits();
}
&*LEGENDRE_EXP
&LEGENDRE_EXP
}

/// Norm of Fq2 as extension field in i over Fq
Expand Down
Loading
Loading