1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 17:15:21 +02:00

Use openssl's sha1 and sha256, optionally (#15472)

This commit is contained in:
DS
2024-12-10 22:00:43 +01:00
committed by GitHub
parent 4f800dd2b4
commit bcbee873e8
17 changed files with 141 additions and 43 deletions

View File

@@ -7,7 +7,7 @@
#include "noise.h"
#include "settings.h"
#include "mapgen/mapgen_v5.h"
#include "util/sha1.h"
#include "util/hashing.h"
#include "map_settings_manager.h"
class TestMapSettingsManager : public TestBase {
@@ -171,11 +171,9 @@ void TestMapSettingsManager::testMapSettingsManager()
0x78, 0x56, 0x95, 0x2d, 0xdc, 0x6a, 0xf7, 0x61, 0x36, 0x5f
};
SHA1 ctx;
std::string metafile_contents;
UASSERT(fs::ReadFile(test_mapmeta_path, metafile_contents));
ctx.addBytes(metafile_contents);
std::string sha1_result = ctx.getDigest();
std::string sha1_result = hashing::sha1(metafile_contents);
int resultdiff = memcmp(sha1_result.data(), expected_contents_hash, 20);
UASSERT(!resultdiff);