diff options
author | Oliver Reiche <oliver.reiche@huawei.com> | 2022-06-15 18:51:47 +0200 |
---|---|---|
committer | Oliver Reiche <oliver.reiche@huawei.com> | 2022-06-20 15:23:02 +0200 |
commit | 855affd9b681d98f248009ddb2c1abe987029f72 (patch) | |
tree | 6d4dbfc2c99020772313f381d2f793950d2b03f4 /src/buildtool/crypto/hasher.cpp | |
parent | 391d982f2fbd98a2973f14e0b5969f66c2abd756 (diff) | |
download | justbuild-855affd9b681d98f248009ddb2c1abe987029f72.tar.gz |
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.
Diffstat (limited to 'src/buildtool/crypto/hasher.cpp')
-rw-r--r-- | src/buildtool/crypto/hasher.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
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<IHashImpl> { + switch (type) { + case HashType::SHA1: + return CreateHashImplSha1(); + case HashType::SHA256: + return CreateHashImplSha256(); + } +} |