From 1fe3ba17c0d7c16df5fe5c6e9a8adf41e4748c23 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Wed, 4 Jan 2023 14:11:12 -0500 Subject: [PATCH] LibCrypto: Use nested namespace specifiers in Hash/ --- Userland/Libraries/LibCrypto/Hash/HashFunction.h | 4 +--- Userland/Libraries/LibCrypto/Hash/MD5.cpp | 4 +--- Userland/Libraries/LibCrypto/Hash/MD5.h | 5 +---- Userland/Libraries/LibCrypto/Hash/SHA1.cpp | 4 +--- Userland/Libraries/LibCrypto/Hash/SHA1.h | 4 +--- Userland/Libraries/LibCrypto/Hash/SHA2.cpp | 4 +--- Userland/Libraries/LibCrypto/Hash/SHA2.h | 4 +--- 7 files changed, 7 insertions(+), 22 deletions(-) diff --git a/Userland/Libraries/LibCrypto/Hash/HashFunction.h b/Userland/Libraries/LibCrypto/Hash/HashFunction.h index c863216f61..0dab948740 100644 --- a/Userland/Libraries/LibCrypto/Hash/HashFunction.h +++ b/Userland/Libraries/LibCrypto/Hash/HashFunction.h @@ -10,8 +10,7 @@ #include #include -namespace Crypto { -namespace Hash { +namespace Crypto::Hash { template struct Digest { @@ -59,4 +58,3 @@ protected: virtual ~HashFunction() = default; }; } -} diff --git a/Userland/Libraries/LibCrypto/Hash/MD5.cpp b/Userland/Libraries/LibCrypto/Hash/MD5.cpp index 72cb516d0c..ddf775e7f3 100644 --- a/Userland/Libraries/LibCrypto/Hash/MD5.cpp +++ b/Userland/Libraries/LibCrypto/Hash/MD5.cpp @@ -45,8 +45,7 @@ static constexpr void round_4(u32& a, u32 b, u32 c, u32 d, u32 x, u32 s, u32 ac) a += b; } -namespace Crypto { -namespace Hash { +namespace Crypto::Hash { void MD5::update(u8 const* input, size_t length) { @@ -204,4 +203,3 @@ void MD5::transform(u8 const* block) } } -} diff --git a/Userland/Libraries/LibCrypto/Hash/MD5.h b/Userland/Libraries/LibCrypto/Hash/MD5.h index 699c6b37ff..01b1dc1096 100644 --- a/Userland/Libraries/LibCrypto/Hash/MD5.h +++ b/Userland/Libraries/LibCrypto/Hash/MD5.h @@ -13,8 +13,7 @@ # include #endif -namespace Crypto { -namespace Hash { +namespace Crypto::Hash { namespace MD5Constants { @@ -98,5 +97,3 @@ private: }; } - -} diff --git a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp index 6202225a8b..56022efb7a 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA1.cpp +++ b/Userland/Libraries/LibCrypto/Hash/SHA1.cpp @@ -9,8 +9,7 @@ #include #include -namespace Crypto { -namespace Hash { +namespace Crypto::Hash { static constexpr auto ROTATE_LEFT(u32 value, size_t bits) { @@ -147,4 +146,3 @@ SHA1::DigestType SHA1::peek() } } -} diff --git a/Userland/Libraries/LibCrypto/Hash/SHA1.h b/Userland/Libraries/LibCrypto/Hash/SHA1.h index 19fb0a9bbd..e85a910878 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA1.h +++ b/Userland/Libraries/LibCrypto/Hash/SHA1.h @@ -12,8 +12,7 @@ # include #endif -namespace Crypto { -namespace Hash { +namespace Crypto::Hash { namespace SHA1Constants { @@ -81,4 +80,3 @@ private: }; } -} diff --git a/Userland/Libraries/LibCrypto/Hash/SHA2.cpp b/Userland/Libraries/LibCrypto/Hash/SHA2.cpp index 6876e1e2b5..fda788fbf8 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA2.cpp +++ b/Userland/Libraries/LibCrypto/Hash/SHA2.cpp @@ -7,8 +7,7 @@ #include #include -namespace Crypto { -namespace Hash { +namespace Crypto::Hash { constexpr static auto ROTRIGHT(u32 a, size_t b) { return (a >> b) | (a << (32 - b)); } constexpr static auto CH(u32 x, u32 y, u32 z) { return (x & y) ^ (z & ~x); } constexpr static auto MAJ(u32 x, u32 y, u32 z) { return (x & y) ^ (x & z) ^ (y & z); } @@ -393,4 +392,3 @@ SHA512::DigestType SHA512::peek() return digest; } } -} diff --git a/Userland/Libraries/LibCrypto/Hash/SHA2.h b/Userland/Libraries/LibCrypto/Hash/SHA2.h index 4ac36cbab8..f17c8e7aa0 100644 --- a/Userland/Libraries/LibCrypto/Hash/SHA2.h +++ b/Userland/Libraries/LibCrypto/Hash/SHA2.h @@ -13,8 +13,7 @@ # include #endif -namespace Crypto { -namespace Hash { +namespace Crypto::Hash { namespace SHA256Constants { constexpr static u32 RoundConstants[64] { @@ -233,4 +232,3 @@ private: }; } -}