mirror of
https://github.com/luanti-org/luanti.git
synced 2025-07-02 16:38:41 +00:00
Use openssl's sha1 and sha256, optionally (#15472)
This commit is contained in:
parent
4f800dd2b4
commit
bcbee873e8
17 changed files with 141 additions and 43 deletions
|
@ -5,6 +5,7 @@ set (BENCHMARK_SRCS
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/benchmark_serialize.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/benchmark_mapblock.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/benchmark_mapmodify.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/benchmark_sha.cpp
|
||||
PARENT_SCOPE)
|
||||
|
||||
set (BENCHMARK_CLIENT_SRCS
|
||||
|
|
23
src/benchmark/benchmark_sha.cpp
Normal file
23
src/benchmark/benchmark_sha.cpp
Normal file
|
@ -0,0 +1,23 @@
|
|||
// SPDX-FileCopyrightText: 2024 Luanti Contributors
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
#include "catch.h"
|
||||
#include "util/hashing.h"
|
||||
#include <string>
|
||||
|
||||
TEST_CASE("benchmark_sha")
|
||||
{
|
||||
std::string input;
|
||||
input.resize(100000);
|
||||
|
||||
BENCHMARK("sha1_input100000", i) {
|
||||
input[0] = (char)i;
|
||||
return hashing::sha1(input);
|
||||
};
|
||||
|
||||
BENCHMARK("sha256_input100000", i) {
|
||||
input[0] = (char)i;
|
||||
return hashing::sha256(input);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue