mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-26 18:21:04 +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
21
src/util/hashing.h
Normal file
21
src/util/hashing.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
// SPDX-FileCopyrightText: 2024 Luanti Contributors
|
||||
//
|
||||
// SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace hashing
|
||||
{
|
||||
|
||||
// Size of raw digest in bytes
|
||||
constexpr size_t SHA1_DIGEST_SIZE = 20;
|
||||
constexpr size_t SHA256_DIGEST_SIZE = 32;
|
||||
|
||||
// Returns the digest of data
|
||||
std::string sha1(std::string_view data);
|
||||
std::string sha256(std::string_view data);
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue