forked from zkcrypto/bls12_381
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge contents of upstream
zkcrypto/bls12_381
Resolves #117
- Loading branch information
Eduardo Leegwater Simões
committed
Jun 1, 2023
1 parent
9e6db83
commit b33dfde
Showing
25 changed files
with
6,860 additions
and
780 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#[macro_use] | ||
extern crate criterion; | ||
|
||
extern crate dusk_bls12_381; | ||
use dusk_bls12_381::hash_to_curve::*; | ||
use dusk_bls12_381::*; | ||
|
||
use criterion::{black_box, Criterion}; | ||
|
||
fn criterion_benchmark(c: &mut Criterion) { | ||
// G1Projective | ||
{ | ||
let name = "G1Projective"; | ||
|
||
let message: &[u8] = b"test message"; | ||
let dst: &[u8] = b"test DST"; | ||
|
||
c.bench_function( | ||
&format!("{} encode_to_curve SSWU SHA-256", name), | ||
move |b| { | ||
b.iter(|| { | ||
<G1Projective as HashToCurve<ExpandMsgXmd<sha2::Sha256>>>::encode_to_curve( | ||
black_box(message), | ||
black_box(dst), | ||
) | ||
}) | ||
}, | ||
); | ||
c.bench_function(&format!("{} hash_to_curve SSWU SHA-256", name), move |b| { | ||
b.iter(|| { | ||
<G1Projective as HashToCurve<ExpandMsgXmd<sha2::Sha256>>>::hash_to_curve( | ||
black_box(message), | ||
black_box(dst), | ||
) | ||
}) | ||
}); | ||
} | ||
// G2Projective | ||
{ | ||
let name = "G2Projective"; | ||
|
||
let message: &[u8] = b"test message"; | ||
let dst: &[u8] = b"test DST"; | ||
|
||
c.bench_function( | ||
&format!("{} encode_to_curve SSWU SHA-256", name), | ||
move |b| { | ||
b.iter(|| { | ||
<G2Projective as HashToCurve<ExpandMsgXmd<sha2::Sha256>>>::encode_to_curve( | ||
black_box(message), | ||
black_box(dst), | ||
) | ||
}) | ||
}, | ||
); | ||
c.bench_function(&format!("{} hash_to_curve SSWU SHA-256", name), move |b| { | ||
b.iter(|| { | ||
<G2Projective as HashToCurve<ExpandMsgXmd<sha2::Sha256>>>::hash_to_curve( | ||
black_box(message), | ||
black_box(dst), | ||
) | ||
}) | ||
}); | ||
} | ||
} | ||
|
||
criterion_group!(benches, criterion_benchmark); | ||
criterion_main!(benches); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[toolchain] | ||
channel = "nightly" | ||
components = ["rustfmt", "clippy"] | ||
components = ["clippy", "rustfmt"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.