summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buildtool/crypto/hash_generator.hpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/buildtool/crypto/hash_generator.hpp b/src/buildtool/crypto/hash_generator.hpp
index 79d744fc..dc720912 100644
--- a/src/buildtool/crypto/hash_generator.hpp
+++ b/src/buildtool/crypto/hash_generator.hpp
@@ -42,10 +42,14 @@ class HashGenerator {
public:
/// \brief Get pointer to raw bytes of digest.
/// Length can be obtained using \ref Length.
- [[nodiscard]] auto Bytes() const -> std::string const& {
+ [[nodiscard]] auto Bytes() const& -> std::string const& {
return bytes_;
}
+ [[nodiscard]] auto Bytes() && -> std::string {
+ return std::move(bytes_);
+ }
+
/// \brief Get hexadecimal string of digest.
/// Length is twice the length of raw bytes (\ref Length).
[[nodiscard]] auto HexString() const -> std::string {
@@ -133,10 +137,15 @@ class HashGenerator {
}
};
+[[nodiscard]] static inline auto ComputeHashDigest(
+ std::string const& data) noexcept -> HashGenerator::HashDigest {
+ return HashGenerator::Instance().Run(data);
+}
+
/// \brief Hash function used for the entire buildtool
-[[maybe_unused]] [[nodiscard]] static inline auto ComputeHash(
- std::string const& data) noexcept -> std::string {
- return HashGenerator::Instance().Run(data).HexString();
+[[nodiscard]] static inline auto ComputeHash(std::string const& data) noexcept
+ -> std::string {
+ return ComputeHashDigest(data).HexString();
}
#endif // INCLUDED_SRC_BUILDTOOL_CRYPTO_HASH_GENERATOR_HPP