From da4232894a77a343ebb1db1ccacfd2138c563aba Mon Sep 17 00:00:00 2001 From: hashlag <90853356+hashlag@users.noreply.github.com> Date: Sun, 10 Aug 2025 21:21:22 +0300 Subject: [PATCH] Conceal algorithms' impl details in service namespaces --- Chaos/Hashing/Md4.hpp | 13 +++++++++---- Chaos/Hashing/Md5.hpp | 13 +++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/Chaos/Hashing/Md4.hpp b/Chaos/Hashing/Md4.hpp index f1785b3..7cd6588 100644 --- a/Chaos/Hashing/Md4.hpp +++ b/Chaos/Hashing/Md4.hpp @@ -8,7 +8,7 @@ #include "Hash.hpp" #include "Hasher.hpp" -namespace Chaos::Hashing::Md4 +namespace Chaos::Hashing::Md4::Inner_ { struct Buffer @@ -129,6 +129,11 @@ private: } }; +} // namespace Chaos::Hashing::Md4::Inner_ + +namespace Chaos::Hashing::Md4 +{ + struct Md4Hash : public Hash { std::array GetRawDigest() const @@ -241,9 +246,9 @@ private: static_assert(std::size(PAD_) == 64); - Buffer Buffer_; + Inner_::Buffer Buffer_; - Block Block_; + Inner_::Block Block_; int_fast8_t BlockSize_; uint32_t Word_; @@ -269,7 +274,7 @@ private: if (BlockSize_ == 16) { - Algorithm::UpdateBuffer(Buffer_, Block_); + Inner_::Algorithm::UpdateBuffer(Buffer_, Block_); BlockSize_ = 0; } } diff --git a/Chaos/Hashing/Md5.hpp b/Chaos/Hashing/Md5.hpp index 87fb03b..f2d44eb 100644 --- a/Chaos/Hashing/Md5.hpp +++ b/Chaos/Hashing/Md5.hpp @@ -8,7 +8,7 @@ #include "Hash.hpp" #include "Hasher.hpp" -namespace Chaos::Hashing::Md5 +namespace Chaos::Hashing::Md5::Inner_ { struct Buffer @@ -153,6 +153,11 @@ private: } }; +} // namespace Chaos::Hashing::Md5::Inner_ + +namespace Chaos::Hashing::Md5 +{ + struct Md5Hash : public Hash { std::array GetRawDigest() const @@ -265,9 +270,9 @@ private: static_assert(std::size(PAD_) == 64); - Buffer Buffer_; + Inner_::Buffer Buffer_; - Block Block_; + Inner_::Block Block_; int_fast8_t BlockSize_; uint32_t Word_; @@ -293,7 +298,7 @@ private: if (BlockSize_ == 16) { - Algorithm::UpdateBuffer(Buffer_, Block_); + Inner_::Algorithm::UpdateBuffer(Buffer_, Block_); BlockSize_ = 0; } }