From d918e998d1f0f1bf5e6e4fc1153b5d92d5dd4e40 Mon Sep 17 00:00:00 2001 From: hashlag Date: Sat, 19 Sep 2026 18:01:13 +0300 Subject: [PATCH] Rename concept Decryptor --> BlockDecryptor. --- Chaos/Cipher/Block/BlockCipher.hpp | 4 ++-- .../Block/{Decryptor.hpp => BlockDecryptor.hpp} | 14 +++++++------- Chaos/Cipher/Block/Des/DesCrypt.hpp | 4 ++-- ChaosTests/Cipher/Block/Des/DesCryptTests.cpp | 6 +++--- 4 files changed, 14 insertions(+), 14 deletions(-) rename Chaos/Cipher/Block/{Decryptor.hpp => BlockDecryptor.hpp} (66%) diff --git a/Chaos/Cipher/Block/BlockCipher.hpp b/Chaos/Cipher/Block/BlockCipher.hpp index d92a9bf..8ce4208 100644 --- a/Chaos/Cipher/Block/BlockCipher.hpp +++ b/Chaos/Cipher/Block/BlockCipher.hpp @@ -6,7 +6,7 @@ #include "BlockKey.hpp" #include "Encryptor.hpp" -#include "Decryptor.hpp" +#include "BlockDecryptor.hpp" namespace Chaos::Cipher::Block { @@ -27,7 +27,7 @@ concept BlockCipher = requires requires BlockKey; requires Encryptor; - requires Decryptor; + requires BlockDecryptor; }; } // namespace Chaos::Cipher::Block diff --git a/Chaos/Cipher/Block/Decryptor.hpp b/Chaos/Cipher/Block/BlockDecryptor.hpp similarity index 66% rename from Chaos/Cipher/Block/Decryptor.hpp rename to Chaos/Cipher/Block/BlockDecryptor.hpp index bd38cf2..7ac969c 100644 --- a/Chaos/Cipher/Block/Decryptor.hpp +++ b/Chaos/Cipher/Block/BlockDecryptor.hpp @@ -1,5 +1,5 @@ -#ifndef CHAOS_CIPHER_BLOCK_DECRYPTOR_HPP -#define CHAOS_CIPHER_BLOCK_DECRYPTOR_HPP +#ifndef CHAOS_CIPHER_BLOCK_BLOCKDECRYPTOR_HPP +#define CHAOS_CIPHER_BLOCK_BLOCKDECRYPTOR_HPP #include #include @@ -9,10 +9,10 @@ namespace Chaos::Cipher::Block { template -concept Decryptor = requires(const T constDecryptor, - typename T::Block block, - uint8_t * outBegin, uint8_t * outEnd, - uint8_t * inBegin, uint8_t * inEnd) +concept BlockDecryptor = requires(const T constDecryptor, + typename T::Block block, + uint8_t * outBegin, uint8_t * outEnd, + uint8_t * inBegin, uint8_t * inEnd) { typename T::Block; typename T::Key; @@ -31,4 +31,4 @@ concept Decryptor = requires(const T constDecryptor, } // namespace Chaos::Cipher::Block -#endif // CHAOS_CIPHER_BLOCK_DECRYPTOR_HPP +#endif // CHAOS_CIPHER_BLOCK_BLOCKDECRYPTOR_HPP diff --git a/Chaos/Cipher/Block/Des/DesCrypt.hpp b/Chaos/Cipher/Block/Des/DesCrypt.hpp index 077ea84..8e2dee4 100644 --- a/Chaos/Cipher/Block/Des/DesCrypt.hpp +++ b/Chaos/Cipher/Block/Des/DesCrypt.hpp @@ -12,7 +12,7 @@ #include "Cipher/Block/BlockKey.hpp" #include "Cipher/Block/Encryptor.hpp" -#include "Cipher/Block/Decryptor.hpp" +#include "Cipher/Block/BlockDecryptor.hpp" #include "Cipher/Block/BlockCipher.hpp" namespace Chaos::Cipher::Block::Des::Inner_ @@ -331,7 +331,7 @@ public: Inner_::KeySchedule Schedule_; }; - static_assert(Chaos::Cipher::Block::Decryptor); + static_assert(Chaos::Cipher::Block::BlockDecryptor); private: using BlockHalf = uint32_t; diff --git a/ChaosTests/Cipher/Block/Des/DesCryptTests.cpp b/ChaosTests/Cipher/Block/Des/DesCryptTests.cpp index 7d9b86b..0cf9d0e 100644 --- a/ChaosTests/Cipher/Block/Des/DesCryptTests.cpp +++ b/ChaosTests/Cipher/Block/Des/DesCryptTests.cpp @@ -7,7 +7,7 @@ #include "Cipher/Block/Des/DesCrypt.hpp" #include "Cipher/Block/Encryptor.hpp" -#include "Cipher/Block/Decryptor.hpp" +#include "Cipher/Block/BlockDecryptor.hpp" #include "Service/ChaosException.hpp" using namespace Chaos::Cipher::Block::Des; @@ -529,7 +529,7 @@ TEST(DesCryptTests, EncryptUInt64BlockGenericTest) ASSERT_EQ(expected, EncryptUInt64BlockGeneric(enc, data)); } -template +template static std::vector DecryptGeneric(const DecryptorImpl & dec, InputIt begin, InputIt end) { @@ -553,7 +553,7 @@ TEST(DesCryptTests, DecryptGenericTest) ASSERT_EQ(expected, DecryptGeneric(dec, data.begin(), data.end())); } -template +template static uint64_t DecryptUInt64BlockGeneric(const DecryptorImpl & dec, uint64_t block) { return dec.DecryptBlock(block);