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/hasher.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/buildtool/crypto/hasher.cpp (limited to 'src/buildtool/crypto/hasher.cpp') diff --git a/src/buildtool/crypto/hasher.cpp b/src/buildtool/crypto/hasher.cpp new file mode 100644 index 00000000..6f432679 --- /dev/null +++ b/src/buildtool/crypto/hasher.cpp @@ -0,0 +1,14 @@ +#include "src/buildtool/crypto/hasher.hpp" + +#include "src/buildtool/crypto/hash_impl_sha1.hpp" +#include "src/buildtool/crypto/hash_impl_sha256.hpp" + +auto Hasher::CreateHashImpl(HashType type) noexcept + -> std::unique_ptr { + switch (type) { + case HashType::SHA1: + return CreateHashImplSha1(); + case HashType::SHA256: + return CreateHashImplSha256(); + } +} -- cgit v1.2.3