From 855affd9b681d98f248009ddb2c1abe987029f72 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Wed, 15 Jun 2022 18:51:47 +0200 Subject: Crypto: Refactor hash computation ... by renaming HashGenerator to (incremental) Hasher and dropping support for Git/MD5 hashes. The Hasher does not expose the actual hash implementation. --- src/buildtool/crypto/hash_impl_sha256.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/buildtool/crypto/hash_impl_sha256.cpp') diff --git a/src/buildtool/crypto/hash_impl_sha256.cpp b/src/buildtool/crypto/hash_impl_sha256.cpp index bbea10d3..8fa80bbc 100644 --- a/src/buildtool/crypto/hash_impl_sha256.cpp +++ b/src/buildtool/crypto/hash_impl_sha256.cpp @@ -1,11 +1,12 @@ +#include "src/buildtool/crypto/hash_impl_sha256.hpp" + #include #include #include "openssl/sha.h" -#include "src/buildtool/crypto/hash_impl.hpp" /// \brief Hash implementation for SHA-256 -class HashImplSha256 final : public IHashImpl { +class HashImplSha256 final : public Hasher::IHashImpl { public: HashImplSha256() { initialized_ = SHA256_Init(&ctx_) == 1; } @@ -35,16 +36,12 @@ class HashImplSha256 final : public IHashImpl { return {}; } - [[nodiscard]] auto DigestLength() const noexcept -> std::size_t final { - return SHA256_DIGEST_LENGTH; - } - private: SHA256_CTX ctx_{}; bool initialized_{}; }; /// \brief Factory for SHA-256 implementation -auto CreateHashImplSha256() -> std::unique_ptr { +auto CreateHashImplSha256() -> std::unique_ptr { return std::make_unique(); } -- cgit v1.2.3