Rename concept Encryptor --> BlockEncryptor.
This commit is contained in:
1 parent
d918e998d1
commit
894f41fa57
4 files changed
+11
-11
No files matched your search
@@ -5,7 +5,7 @@
|
|||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
#include "BlockKey.hpp"
|
#include "BlockKey.hpp"
|
||||||
#include "Encryptor.hpp"
|
#include "BlockEncryptor.hpp"
|
||||||
#include "BlockDecryptor.hpp"
|
#include "BlockDecryptor.hpp"
|
||||||
|
|
||||||
namespace Chaos::Cipher::Block
|
namespace Chaos::Cipher::Block
|
||||||
@@ -26,7 +26,7 @@ concept BlockCipher = requires
|
|||||||
typename std::integral_constant<decltype(T::KeySize), T::KeySize>;
|
typename std::integral_constant<decltype(T::KeySize), T::KeySize>;
|
||||||
|
|
||||||
requires BlockKey<typename T::Key>;
|
requires BlockKey<typename T::Key>;
|
||||||
requires Encryptor<typename T::Encryptor>;
|
requires BlockEncryptor<typename T::Encryptor>;
|
||||||
requires BlockDecryptor<typename T::Decryptor>;
|
requires BlockDecryptor<typename T::Decryptor>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef CHAOS_CIPHER_BLOCK_ENCRYPTOR_HPP
|
#ifndef CHAOS_CIPHER_BLOCK_BLOCKENCRYPTOR_HPP
|
||||||
#define CHAOS_CIPHER_BLOCK_ENCRYPTOR_HPP
|
#define CHAOS_CIPHER_BLOCK_BLOCKENCRYPTOR_HPP
|
||||||
|
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -9,7 +9,7 @@ namespace Chaos::Cipher::Block
|
|||||||
{
|
{
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Encryptor = requires(const T constEncryptor,
|
concept BlockEncryptor = requires(const T constEncryptor,
|
||||||
typename T::Block block,
|
typename T::Block block,
|
||||||
uint8_t * outBegin, uint8_t * outEnd,
|
uint8_t * outBegin, uint8_t * outEnd,
|
||||||
uint8_t * inBegin, uint8_t * inEnd)
|
uint8_t * inBegin, uint8_t * inEnd)
|
||||||
@@ -31,4 +31,4 @@ concept Encryptor = requires(const T constEncryptor,
|
|||||||
|
|
||||||
} // namespace Chaos::Cipher::Block
|
} // namespace Chaos::Cipher::Block
|
||||||
|
|
||||||
#endif // CHAOS_CIPHER_BLOCK_ENCRYPTOR_HPP
|
#endif // CHAOS_CIPHER_BLOCK_BLOCKENCRYPTOR_HPP
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#include "Service/SeArray.hpp"
|
#include "Service/SeArray.hpp"
|
||||||
|
|
||||||
#include "Cipher/Block/BlockKey.hpp"
|
#include "Cipher/Block/BlockKey.hpp"
|
||||||
#include "Cipher/Block/Encryptor.hpp"
|
#include "Cipher/Block/BlockEncryptor.hpp"
|
||||||
#include "Cipher/Block/BlockDecryptor.hpp"
|
#include "Cipher/Block/BlockDecryptor.hpp"
|
||||||
#include "Cipher/Block/BlockCipher.hpp"
|
#include "Cipher/Block/BlockCipher.hpp"
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ public:
|
|||||||
Inner_::KeySchedule Schedule_;
|
Inner_::KeySchedule Schedule_;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(Chaos::Cipher::Block::Encryptor<Encryptor>);
|
static_assert(Chaos::Cipher::Block::BlockEncryptor<Encryptor>);
|
||||||
|
|
||||||
class Decryptor
|
class Decryptor
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Cipher/Block/Des/DesCrypt.hpp"
|
#include "Cipher/Block/Des/DesCrypt.hpp"
|
||||||
#include "Cipher/Block/Encryptor.hpp"
|
#include "Cipher/Block/BlockEncryptor.hpp"
|
||||||
#include "Cipher/Block/BlockDecryptor.hpp"
|
#include "Cipher/Block/BlockDecryptor.hpp"
|
||||||
#include "Service/ChaosException.hpp"
|
#include "Service/ChaosException.hpp"
|
||||||
|
|
||||||
@@ -486,7 +486,7 @@ TEST(DesCryptTests, OutIteratorUsageDecryptTest)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Encryptor EncryptorImpl, typename InputIt>
|
template<BlockEncryptor EncryptorImpl, typename InputIt>
|
||||||
static std::vector<uint8_t> EncryptGeneric(const EncryptorImpl & enc,
|
static std::vector<uint8_t> EncryptGeneric(const EncryptorImpl & enc,
|
||||||
InputIt begin, InputIt end)
|
InputIt begin, InputIt end)
|
||||||
{
|
{
|
||||||
@@ -510,7 +510,7 @@ TEST(DesCryptTests, EncryptGenericTest)
|
|||||||
ASSERT_EQ(expected, EncryptGeneric(enc, data.begin(), data.end()));
|
ASSERT_EQ(expected, EncryptGeneric(enc, data.begin(), data.end()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Encryptor EncryptorImpl>
|
template<BlockEncryptor EncryptorImpl>
|
||||||
static uint64_t EncryptUInt64BlockGeneric(const EncryptorImpl & enc, uint64_t block)
|
static uint64_t EncryptUInt64BlockGeneric(const EncryptorImpl & enc, uint64_t block)
|
||||||
{
|
{
|
||||||
return enc.EncryptBlock(block);
|
return enc.EncryptBlock(block);
|
||||||
|
|||||||
Reference in new issue
Block a user