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.hpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/buildtool/crypto/hash_function.hpp b/src/buildtool/crypto/hash_function.hpp
index 9e5a9c0b..530e0b2b 100644
--- a/src/buildtool/crypto/hash_function.hpp
+++ b/src/buildtool/crypto/hash_function.hpp
@@ -95,4 +95,15 @@ class HashFunction {
-> std::optional<std::pair<Hasher::HashDigest, std::uintmax_t>>;
};
+[[nodiscard]] constexpr auto ToString(HashFunction::Type type) noexcept -> const
+ char* {
+ switch (type) {
+ case HashFunction::Type::GitSHA1:
+ return "git-SHA1";
+ case HashFunction::Type::PlainSHA256:
+ return "plain-SHA256";
+ }
+ Ensures(false); // unreachable
+}
+
#endif // INCLUDED_SRC_BUILDTOOL_CRYPTO_HASH_FUNCTION_HPP