From cb219708923df26e0efc0ce172e1be7414287fe2 Mon Sep 17 00:00:00 2001 From: Andreas Grois Date: Sun, 23 Oct 2022 15:51:30 +0200 Subject: Fix benchmark errors. 20 bytes worst case was using 16 bytes. 32 bytes full division was producing a leading zero. --- .gitignore | 1 + benches/hashrate_20.rs | 2 +- benches/mock_hashers/mod.rs | 10 +++++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 89e1cba..52d546c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/.vscode /target /Cargo.lock *~ diff --git a/benches/hashrate_20.rs b/benches/hashrate_20.rs index 3999380..b661df7 100644 --- a/benches/hashrate_20.rs +++ b/benches/hashrate_20.rs @@ -46,7 +46,7 @@ fn criterion_bench_20bytes_full_divide(c: &mut Criterion) { fn criterion_bench_20bytes_worst_case(c: &mut Criterion) { let pwm = Pwm::new( - HashAlgorithm::Md5, + HashAlgorithm::Ripemd160, passwordmaker_rs::UseLeetWhenGenerating::NotAtAll, "XY", "", diff --git a/benches/mock_hashers/mod.rs b/benches/mock_hashers/mod.rs index 29e91b9..5eb9ea7 100644 --- a/benches/mock_hashers/mod.rs +++ b/benches/mock_hashers/mod.rs @@ -13,31 +13,31 @@ pub(crate) struct MockRipeMD160; impl Hasher for MockMd4{ type Output = [u8;16]; fn hash(_data : &[u8]) -> Self::Output { - black_box([156u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8]) + black_box([219u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8]) } } impl Hasher for MockMd5{ type Output = [u8;16]; fn hash(_data : &[u8]) -> Self::Output { - black_box([156u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8]) + black_box([219u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8]) } } impl Hasher for MockSha1{ type Output = [u8;20]; fn hash(_data : &[u8]) -> Self::Output { - black_box([156u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8,46,49,13,24]) + black_box([219u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8,46,49,13,24]) } } impl Hasher for MockSha256{ type Output = [u8;32]; fn hash(_data : &[u8]) -> Self::Output { - black_box([156u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8,156u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8]) + black_box([219u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8,156u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8]) } } impl Hasher for MockRipeMD160{ type Output = [u8;20]; fn hash(_data : &[u8]) -> Self::Output { - black_box([156u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8,46,49,13,24]) + black_box([219u8,4u8,123u8,54u8,91u8,85u8,34u8,159u8,243u8,210u8,35u8,41u8,31u8,34u8,75u8,94u8,46,49,13,24]) } } -- cgit v1.2.3