summaryrefslogtreecommitdiff
path: root/src/buildtool/crypto/hash_function.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/crypto/hash_function.hpp')
-rw-r--r--src/buildtool/crypto/hash_function.hpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/buildtool/crypto/hash_function.hpp b/src/buildtool/crypto/hash_function.hpp
index 44341777..fa141ed2 100644
--- a/src/buildtool/crypto/hash_function.hpp
+++ b/src/buildtool/crypto/hash_function.hpp
@@ -16,9 +16,11 @@
#define INCLUDED_SRC_BUILDTOOL_CRYPTO_HASH_FUNCTION_HPP
#include <cstdint>
+#include <filesystem>
#include <functional>
#include <optional>
#include <string>
+#include <utility>
#include "src/buildtool/crypto/hasher.hpp"
@@ -53,6 +55,12 @@ class HashFunction {
return ComputeTaggedHash(data, kBlobTagCreator);
}
+ /// \brief Compute the blob hash of a file or std::nullopt on IO error.
+ [[nodiscard]] static auto ComputeHashFile(
+ const std::filesystem::path& file_path,
+ bool as_tree) noexcept
+ -> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>>;
+
/// \brief Compute a tree hash.
[[nodiscard]] static auto ComputeTreeHash(std::string const& data) noexcept
-> Hasher::HashDigest {