diff options
Diffstat (limited to 'src/buildtool/crypto/hash_function.hpp')
-rw-r--r-- | src/buildtool/crypto/hash_function.hpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/buildtool/crypto/hash_function.hpp b/src/buildtool/crypto/hash_function.hpp index c73458eb..99a15cdb 100644 --- a/src/buildtool/crypto/hash_function.hpp +++ b/src/buildtool/crypto/hash_function.hpp @@ -69,13 +69,17 @@ class HashFunction { /// \brief Obtain incremental hasher for computing plain hashes. [[nodiscard]] auto MakeHasher() const noexcept -> Hasher { + std::optional<Hasher> hasher; switch (type_) { case JustHash::Native: - return Hasher{Hasher::HashType::SHA1}; + hasher = Hasher::Create(Hasher::HashType::SHA1); + break; case JustHash::Compatible: - return Hasher{Hasher::HashType::SHA256}; + hasher = Hasher::Create(Hasher::HashType::SHA256); + break; } - Ensures(false); // unreachable + Ensures(hasher.has_value()); + return *std::move(hasher); } private: |