aboutsummaryrefslogtreecommitdiff
path: root/benches
diff options
context:
space:
mode:
Diffstat (limited to 'benches')
-rw-r--r--benches/hashrate_16_hmac.rs38
1 files changed, 9 insertions, 29 deletions
diff --git a/benches/hashrate_16_hmac.rs b/benches/hashrate_16_hmac.rs
index 9a8deb7..cc3e0ea 100644
--- a/benches/hashrate_16_hmac.rs
+++ b/benches/hashrate_16_hmac.rs
@@ -6,7 +6,7 @@ use criterion::{black_box, criterion_group, criterion_main, Criterion};
use passwordmaker_rs::HashAlgorithm;
use mock_hashers::Pwm;
-fn criterion_bench_16bytes_hmac_typical(c: &mut Criterion) {
+fn criterion_bench_16bytes_hmac_long_key(c: &mut Criterion) {
let pwm = Pwm::new(
HashAlgorithm::HmacMd5,
passwordmaker_rs::UseLeetWhenGenerating::NotAtAll,
@@ -17,7 +17,7 @@ fn criterion_bench_16bytes_hmac_typical(c: &mut Criterion) {
"",
""
).unwrap();
- c.bench_function("16 bytes HMAC typical", |b| b.iter(|| {
+ c.bench_function("16 bytes HMAC long key", |b| b.iter(|| {
pwm.generate(
black_box("This is a long string. With many, many characters. For no particular reason.".to_owned()),
black_box("And another relatively long string for no reason other than it being long.".to_owned())
@@ -25,40 +25,21 @@ fn criterion_bench_16bytes_hmac_typical(c: &mut Criterion) {
}));
}
-fn criterion_bench_16bytes_hmac_full_divide(c: &mut Criterion) {
+fn criterion_bench_16bytes_hmac_short_key(c: &mut Criterion) {
let pwm = Pwm::new(
- HashAlgorithm::HmacMd5,
+ HashAlgorithm::HmacMd5,
passwordmaker_rs::UseLeetWhenGenerating::NotAtAll,
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789`~!@#$%^&*()_-+={}|[]\\:\";'<>?,./",
"",
"",
- 20,
- "",
- ""
- ).unwrap();
- c.bench_function("16 bytes HMAC full divide", |b| b.iter(|| {
- pwm.generate(
- black_box("This is a long string. With many, many characters. For no particular reason.".to_owned()),
- black_box("And another relatively long string for no reason other than it being long.".to_owned())
- )
- }));
-}
-
-fn criterion_bench_16bytes_hmac_worst_case(c: &mut Criterion) {
- let pwm = Pwm::new(
- HashAlgorithm::HmacMd5,
- passwordmaker_rs::UseLeetWhenGenerating::NotAtAll,
- "XY",
- "",
- "",
- 128,
+ 12,
"",
""
).unwrap();
- c.bench_function("16 bytes HMAC worst case", |b| b.iter(|| {
+ c.bench_function("16 bytes HMAC short key", |b| b.iter(|| {
pwm.generate(
black_box("This is a long string. With many, many characters. For no particular reason.".to_owned()),
- black_box("And another relatively long string for no reason other than it being long.".to_owned())
+ black_box("Short Key".to_owned())
)
}));
}
@@ -66,8 +47,7 @@ fn criterion_bench_16bytes_hmac_worst_case(c: &mut Criterion) {
criterion_group!(name = benches;
// This can be any expression that returns a `Criterion` object.
config = Criterion::default().significance_level(0.02).sample_size(500).measurement_time(Duration::from_secs(10));
- targets = criterion_bench_16bytes_hmac_typical,
- criterion_bench_16bytes_hmac_full_divide,
- criterion_bench_16bytes_hmac_worst_case,
+ targets = criterion_bench_16bytes_hmac_long_key,
+ criterion_bench_16bytes_hmac_short_key,
);
criterion_main!(benches);