Rename concept Decryptor --> BlockDecryptor.
This commit is contained in:
1 parent
0394c42238
commit
d918e998d1
4 files changed
+14
-14
No files matched your search
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#include "BlockKey.hpp"
|
#include "BlockKey.hpp"
|
||||||
#include "Encryptor.hpp"
|
#include "Encryptor.hpp"
|
||||||
#include "Decryptor.hpp"
|
#include "BlockDecryptor.hpp"
|
||||||
|
|
||||||
namespace Chaos::Cipher::Block
|
namespace Chaos::Cipher::Block
|
||||||
{
|
{
|
||||||
@@ -27,7 +27,7 @@ concept BlockCipher = requires
|
|||||||
|
|
||||||
requires BlockKey<typename T::Key>;
|
requires BlockKey<typename T::Key>;
|
||||||
requires Encryptor<typename T::Encryptor>;
|
requires Encryptor<typename T::Encryptor>;
|
||||||
requires Decryptor<typename T::Decryptor>;
|
requires BlockDecryptor<typename T::Decryptor>;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Chaos::Cipher::Block
|
} // namespace Chaos::Cipher::Block
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#ifndef CHAOS_CIPHER_BLOCK_DECRYPTOR_HPP
|
#ifndef CHAOS_CIPHER_BLOCK_BLOCKDECRYPTOR_HPP
|
||||||
#define CHAOS_CIPHER_BLOCK_DECRYPTOR_HPP
|
#define CHAOS_CIPHER_BLOCK_BLOCKDECRYPTOR_HPP
|
||||||
|
|
||||||
#include <concepts>
|
#include <concepts>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -9,10 +9,10 @@ namespace Chaos::Cipher::Block
|
|||||||
{
|
{
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
concept Decryptor = requires(const T constDecryptor,
|
concept BlockDecryptor = requires(const T constDecryptor,
|
||||||
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)
|
||||||
{
|
{
|
||||||
typename T::Block;
|
typename T::Block;
|
||||||
typename T::Key;
|
typename T::Key;
|
||||||
@@ -31,4 +31,4 @@ concept Decryptor = requires(const T constDecryptor,
|
|||||||
|
|
||||||
} // namespace Chaos::Cipher::Block
|
} // namespace Chaos::Cipher::Block
|
||||||
|
|
||||||
#endif // CHAOS_CIPHER_BLOCK_DECRYPTOR_HPP
|
#endif // CHAOS_CIPHER_BLOCK_BLOCKDECRYPTOR_HPP
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "Cipher/Block/BlockKey.hpp"
|
#include "Cipher/Block/BlockKey.hpp"
|
||||||
#include "Cipher/Block/Encryptor.hpp"
|
#include "Cipher/Block/Encryptor.hpp"
|
||||||
#include "Cipher/Block/Decryptor.hpp"
|
#include "Cipher/Block/BlockDecryptor.hpp"
|
||||||
#include "Cipher/Block/BlockCipher.hpp"
|
#include "Cipher/Block/BlockCipher.hpp"
|
||||||
|
|
||||||
namespace Chaos::Cipher::Block::Des::Inner_
|
namespace Chaos::Cipher::Block::Des::Inner_
|
||||||
@@ -331,7 +331,7 @@ public:
|
|||||||
Inner_::KeySchedule Schedule_;
|
Inner_::KeySchedule Schedule_;
|
||||||
};
|
};
|
||||||
|
|
||||||
static_assert(Chaos::Cipher::Block::Decryptor<Decryptor>);
|
static_assert(Chaos::Cipher::Block::BlockDecryptor<Decryptor>);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
using BlockHalf = uint32_t;
|
using BlockHalf = uint32_t;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
#include "Cipher/Block/Des/DesCrypt.hpp"
|
#include "Cipher/Block/Des/DesCrypt.hpp"
|
||||||
#include "Cipher/Block/Encryptor.hpp"
|
#include "Cipher/Block/Encryptor.hpp"
|
||||||
#include "Cipher/Block/Decryptor.hpp"
|
#include "Cipher/Block/BlockDecryptor.hpp"
|
||||||
#include "Service/ChaosException.hpp"
|
#include "Service/ChaosException.hpp"
|
||||||
|
|
||||||
using namespace Chaos::Cipher::Block::Des;
|
using namespace Chaos::Cipher::Block::Des;
|
||||||
@@ -529,7 +529,7 @@ TEST(DesCryptTests, EncryptUInt64BlockGenericTest)
|
|||||||
ASSERT_EQ(expected, EncryptUInt64BlockGeneric(enc, data));
|
ASSERT_EQ(expected, EncryptUInt64BlockGeneric(enc, data));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Decryptor DecryptorImpl, typename InputIt>
|
template<BlockDecryptor DecryptorImpl, typename InputIt>
|
||||||
static std::vector<uint8_t> DecryptGeneric(const DecryptorImpl & dec,
|
static std::vector<uint8_t> DecryptGeneric(const DecryptorImpl & dec,
|
||||||
InputIt begin, InputIt end)
|
InputIt begin, InputIt end)
|
||||||
{
|
{
|
||||||
@@ -553,7 +553,7 @@ TEST(DesCryptTests, DecryptGenericTest)
|
|||||||
ASSERT_EQ(expected, DecryptGeneric(dec, data.begin(), data.end()));
|
ASSERT_EQ(expected, DecryptGeneric(dec, data.begin(), data.end()));
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Decryptor DecryptorImpl>
|
template<BlockDecryptor DecryptorImpl>
|
||||||
static uint64_t DecryptUInt64BlockGeneric(const DecryptorImpl & dec, uint64_t block)
|
static uint64_t DecryptUInt64BlockGeneric(const DecryptorImpl & dec, uint64_t block)
|
||||||
{
|
{
|
||||||
return dec.DecryptBlock(block);
|
return dec.DecryptBlock(block);
|
||||||
|
|||||||
Reference in new issue
Block a user