-
Notifications
You must be signed in to change notification settings - Fork 17
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
Changing sha2 benchmarks to refer to the faster Hacl_SHA2_Streaming versions #362
base: main
Are you sure you want to change the base?
Changes from all commits
1134e41
e3769d6
98f1541
a883b08
ef519aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,6 @@ | |
#include "EverCrypt_Hash.h" | ||
#include "Hacl_Streaming_SHA2.h" | ||
|
||
#ifdef HACL_CAN_COMPILE_VEC128 | ||
#include "Hacl_Hash_Blake2s_128.h" | ||
#endif | ||
|
||
#ifdef HACL_CAN_COMPILE_VEC256 | ||
#include "Hacl_Hash_Blake2b_256.h" | ||
#endif | ||
|
||
#include "util.h" | ||
|
||
#define HACL_HASH_SHA2_224_DIGEST_LENGTH 28 | ||
|
@@ -59,6 +51,29 @@ HACL_Sha2_oneshot(benchmark::State& state, Args&&... args) | |
} | ||
} | ||
|
||
|
||
template<class... Args> | ||
void | ||
HACL_Sha2_new_oneshot(benchmark::State& state, Args&&... args) | ||
{ | ||
auto args_tuple = std::make_tuple(std::move(args)...); | ||
|
||
auto digest_len = std::get<0>(args_tuple); | ||
auto expected_digest = std::get<1>(args_tuple); | ||
auto hash = std::get<2>(args_tuple); | ||
|
||
bytes digest(digest_len, 0); | ||
|
||
for (auto _ : state) { | ||
hash(digest.data(), input.size(), (uint8_t*)input.data()); | ||
} | ||
|
||
if (digest != expected_digest) { | ||
state.SkipWithError("Incorrect digest."); | ||
return; | ||
} | ||
} | ||
|
||
template<class... Args> | ||
void | ||
EverCrypt_Sha2_oneshot(benchmark::State& state, Args&&... args) | ||
|
@@ -159,7 +174,7 @@ BENCHMARK_CAPTURE(HACL_Sha2_oneshot, | |
sha2_224, | ||
HACL_HASH_SHA2_224_DIGEST_LENGTH, | ||
expected_digest_sha2_224, | ||
Hacl_Hash_SHA2_hash_224) | ||
Hacl_Streaming_SHA2_sha224) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes the benchmark pretend like the oneshot function exposed by the library have this performance. Which they don't
I'm fine with doing this in follow-ups. But it either needs to be filed as follow-ups to tackle after this (maybe @duesee or @pnmadelaine can take care of this), or done here. |
||
->Setup(DoSetup); | ||
|
||
BENCHMARK_CAPTURE(EverCrypt_Sha2_oneshot, | ||
|
@@ -182,7 +197,7 @@ BENCHMARK_CAPTURE(HACL_Sha2_oneshot, | |
sha2_256, | ||
HACL_HASH_SHA2_256_DIGEST_LENGTH, | ||
expected_digest_sha2_256, | ||
Hacl_Hash_SHA2_hash_256) | ||
Hacl_Streaming_SHA2_sha256) | ||
->Setup(DoSetup); | ||
|
||
BENCHMARK_CAPTURE(EverCrypt_Sha2_oneshot, | ||
|
@@ -205,7 +220,7 @@ BENCHMARK_CAPTURE(HACL_Sha2_oneshot, | |
sha2_384, | ||
HACL_HASH_SHA2_384_DIGEST_LENGTH, | ||
expected_digest_sha2_384, | ||
Hacl_Hash_SHA2_hash_384) | ||
Hacl_Streaming_SHA2_sha384) | ||
->Setup(DoSetup); | ||
|
||
BENCHMARK_CAPTURE(EverCrypt_Sha2_oneshot, | ||
|
@@ -228,7 +243,7 @@ BENCHMARK_CAPTURE(HACL_Sha2_oneshot, | |
sha2_512, | ||
HACL_HASH_SHA2_512_DIGEST_LENGTH, | ||
expected_digest_sha2_512, | ||
Hacl_Hash_SHA2_hash_512) | ||
Hacl_Streaming_SHA2_sha512) | ||
->Setup(DoSetup); | ||
|
||
BENCHMARK_CAPTURE(EverCrypt_Sha2_oneshot, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this function isn't used?
Please remove or use.