mirror of https://github.com/dnomd343/md5sum.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
466 B
26 lines
466 B
#include <benchmark/benchmark.h>
|
|
|
|
#include "md5.h"
|
|
|
|
std::string test_data() {
|
|
char data[64];
|
|
for (char i = 0; i < 64; ++i) {
|
|
data[i] = i;
|
|
}
|
|
return {data, data + 64};
|
|
}
|
|
|
|
static void BM_MD5_NEXT(benchmark::State &state) {
|
|
const auto data = test_data();
|
|
|
|
md5::MD5::md5_ctx c;
|
|
md5::MD5::md5_reset(&c);
|
|
|
|
for (auto _ : state) {
|
|
md5::MD5::md5_update(&c, data.c_str(), 64);
|
|
}
|
|
}
|
|
|
|
BENCHMARK(BM_MD5_NEXT);
|
|
|
|
BENCHMARK_MAIN();
|
|
|