updated build system
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
2025-08-26 20:08:47 -05:00
parent 8fabc142f2
commit 1d7e96f3a4
20 changed files with 521 additions and 47 deletions

View File

@@ -28,10 +28,33 @@
#include "utils/error.hpp"
namespace repertory::utils::hash {
using hash_32_t = std::array<unsigned char, 4U>;
using hash_64_t = std::array<unsigned char, 8U>;
using hash_128_t = std::array<unsigned char, 16U>;
using hash_256_t = std::array<unsigned char, 32U>;
using hash_384_t = std::array<unsigned char, 48U>;
using hash_512_t = std::array<unsigned char, 64U>;
[[nodiscard]] auto create_hash_blake2b_32(std::string_view data) -> hash_32_t;
[[nodiscard]] auto create_hash_blake2b_32(std::wstring_view data) -> hash_32_t;
[[nodiscard]] auto create_hash_blake2b_32(const data_buffer &data) -> hash_32_t;
[[nodiscard]] auto create_hash_blake2b_64(std::string_view data) -> hash_64_t;
[[nodiscard]] auto create_hash_blake2b_64(std::wstring_view data) -> hash_64_t;
[[nodiscard]] auto create_hash_blake2b_64(const data_buffer &data) -> hash_64_t;
[[nodiscard]] auto create_hash_blake2b_128(std::string_view data) -> hash_128_t;
[[nodiscard]] auto create_hash_blake2b_128(std::wstring_view data)
-> hash_128_t;
[[nodiscard]] auto create_hash_blake2b_128(const data_buffer &data)
-> hash_128_t;
[[nodiscard]] auto create_hash_blake2b_256(std::string_view data) -> hash_256_t;
[[nodiscard]] auto create_hash_blake2b_256(std::wstring_view data)
@@ -123,6 +146,27 @@ auto create_hash_blake2b_t(const unsigned char *data, std::size_t data_size)
return hash;
}
inline const std::function<hash_32_t(const unsigned char *data,
std::size_t size)>
blake2b_32_hasher =
[](const unsigned char *data, std::size_t data_size) -> hash_32_t {
return create_hash_blake2b_t<hash_32_t>(data, data_size);
};
inline const std::function<hash_64_t(const unsigned char *data,
std::size_t size)>
blake2b_64_hasher =
[](const unsigned char *data, std::size_t data_size) -> hash_64_t {
return create_hash_blake2b_t<hash_64_t>(data, data_size);
};
inline const std::function<hash_128_t(const unsigned char *data,
std::size_t size)>
blake2b_128_hasher =
[](const unsigned char *data, std::size_t data_size) -> hash_128_t {
return create_hash_blake2b_t<hash_128_t>(data, data_size);
};
inline const std::function<hash_256_t(const unsigned char *data,
std::size_t size)>
blake2b_256_hasher =
@@ -158,6 +202,24 @@ inline const std::function<hash_512_t(const unsigned char *data,
return create_hash_sha512(data, data_size);
};
template <>
[[nodiscard]] inline auto default_create_hash<hash_32_t>() -> const
std::function<hash_32_t(const unsigned char *data, std::size_t size)> & {
return blake2b_32_hasher;
}
template <>
[[nodiscard]] inline auto default_create_hash<hash_64_t>() -> const
std::function<hash_64_t(const unsigned char *data, std::size_t size)> & {
return blake2b_64_hasher;
}
template <>
[[nodiscard]] inline auto default_create_hash<hash_128_t>() -> const
std::function<hash_128_t(const unsigned char *data, std::size_t size)> & {
return blake2b_128_hasher;
}
template <>
[[nodiscard]] inline auto default_create_hash<hash_256_t>() -> const
std::function<hash_256_t(const unsigned char *data, std::size_t size)> & {