Mark all Block::Encryptor<> methods const.
This allows for convenient usage of const Encryptor<Impl> &.
This commit is contained in:
@@ -237,7 +237,7 @@ public:
|
||||
{ }
|
||||
|
||||
template<typename OutputIt, typename InputIt>
|
||||
void EncryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd)
|
||||
void EncryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd) const
|
||||
{
|
||||
RawBlockArray block;
|
||||
|
||||
@@ -255,12 +255,12 @@ public:
|
||||
Inner_::Bitwise::CrunchUInt64(out, encrypted);
|
||||
}
|
||||
|
||||
Block EncryptBlock(Block block)
|
||||
Block EncryptBlock(Block block) const
|
||||
{
|
||||
return DesCrypt::ProcessBlock(block, Schedule_);
|
||||
}
|
||||
|
||||
constexpr size_t GetBlockSize()
|
||||
constexpr size_t GetBlockSize() const
|
||||
{
|
||||
return BlockSize;
|
||||
}
|
||||
|
||||
@@ -9,18 +9,18 @@ class Encryptor
|
||||
{
|
||||
public:
|
||||
template<typename OutputIt, typename InputIt>
|
||||
void EncryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd)
|
||||
void EncryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd) const
|
||||
{
|
||||
Impl().EncryptBlock(out, inBegin, inEnd);
|
||||
}
|
||||
|
||||
template<typename Block>
|
||||
auto EncryptBlock(Block block)
|
||||
auto EncryptBlock(Block block) const
|
||||
{
|
||||
return Impl().EncryptBlock(block);
|
||||
}
|
||||
|
||||
auto GetBlockSize()
|
||||
auto GetBlockSize() const
|
||||
{
|
||||
return Impl().GetBlockSize();
|
||||
}
|
||||
|
||||
@@ -498,7 +498,7 @@ TEST(DesCryptTests, OutIteratorUsageDecryptTest)
|
||||
}
|
||||
|
||||
template<typename Impl, typename InputIt>
|
||||
static std::vector<uint8_t> EncryptThroughBase(Encryptor<Impl> & enc,
|
||||
static std::vector<uint8_t> EncryptThroughBase(const Encryptor<Impl> & enc,
|
||||
InputIt begin, InputIt end)
|
||||
{
|
||||
std::vector<uint8_t> result;
|
||||
@@ -522,7 +522,7 @@ TEST(DesCryptTests, EncryptThroughBaseTest)
|
||||
}
|
||||
|
||||
template<typename Impl>
|
||||
static uint64_t EncryptUInt64BlockThroughBase(Encryptor<Impl> & enc, uint64_t block)
|
||||
static uint64_t EncryptUInt64BlockThroughBase(const Encryptor<Impl> & enc, uint64_t block)
|
||||
{
|
||||
return enc.EncryptBlock(block);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user