Compare commits
2 Commits
a97826da88
...
d194fef1af
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d194fef1af | ||
|
|
cdcab2f4f7 |
@@ -9,18 +9,18 @@ class Decryptor
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template<typename OutputIt, typename InputIt>
|
template<typename OutputIt, typename InputIt>
|
||||||
void DecryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd)
|
void DecryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd) const
|
||||||
{
|
{
|
||||||
Impl().DecryptBlock(out, inBegin, inEnd);
|
Impl().DecryptBlock(out, inBegin, inEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Block>
|
template<typename Block>
|
||||||
auto DecryptBlock(Block block)
|
auto DecryptBlock(Block block) const
|
||||||
{
|
{
|
||||||
return Impl().DecryptBlock(block);
|
return Impl().DecryptBlock(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto GetBlockSize()
|
auto GetBlockSize() const
|
||||||
{
|
{
|
||||||
return Impl().GetBlockSize();
|
return Impl().GetBlockSize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
template<typename OutputIt, typename InputIt>
|
template<typename OutputIt, typename InputIt>
|
||||||
void EncryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd)
|
void EncryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd) const
|
||||||
{
|
{
|
||||||
RawBlockArray block;
|
RawBlockArray block;
|
||||||
|
|
||||||
@@ -255,12 +255,12 @@ public:
|
|||||||
Inner_::Bitwise::CrunchUInt64(out, encrypted);
|
Inner_::Bitwise::CrunchUInt64(out, encrypted);
|
||||||
}
|
}
|
||||||
|
|
||||||
Block EncryptBlock(Block block)
|
Block EncryptBlock(Block block) const
|
||||||
{
|
{
|
||||||
return DesCrypt::ProcessBlock(block, Schedule_);
|
return DesCrypt::ProcessBlock(block, Schedule_);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr size_t GetBlockSize()
|
constexpr size_t GetBlockSize() const
|
||||||
{
|
{
|
||||||
return BlockSize;
|
return BlockSize;
|
||||||
}
|
}
|
||||||
@@ -279,7 +279,7 @@ public:
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
template<typename OutputIt, typename InputIt>
|
template<typename OutputIt, typename InputIt>
|
||||||
void DecryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd)
|
void DecryptBlock(OutputIt out, InputIt inBegin, InputIt inEnd) const
|
||||||
{
|
{
|
||||||
RawBlockArray block;
|
RawBlockArray block;
|
||||||
|
|
||||||
@@ -297,12 +297,12 @@ public:
|
|||||||
Inner_::Bitwise::CrunchUInt64(out, decrypted);
|
Inner_::Bitwise::CrunchUInt64(out, decrypted);
|
||||||
}
|
}
|
||||||
|
|
||||||
Block DecryptBlock(Block block)
|
Block DecryptBlock(Block block) const
|
||||||
{
|
{
|
||||||
return DesCrypt::ProcessBlock(block, Schedule_);
|
return DesCrypt::ProcessBlock(block, Schedule_);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr size_t GetBlockSize()
|
constexpr size_t GetBlockSize() const
|
||||||
{
|
{
|
||||||
return BlockSize;
|
return BlockSize;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,18 +9,18 @@ class Encryptor
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template<typename OutputIt, typename InputIt>
|
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);
|
Impl().EncryptBlock(out, inBegin, inEnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename Block>
|
template<typename Block>
|
||||||
auto EncryptBlock(Block block)
|
auto EncryptBlock(Block block) const
|
||||||
{
|
{
|
||||||
return Impl().EncryptBlock(block);
|
return Impl().EncryptBlock(block);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto GetBlockSize()
|
auto GetBlockSize() const
|
||||||
{
|
{
|
||||||
return Impl().GetBlockSize();
|
return Impl().GetBlockSize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -498,7 +498,7 @@ TEST(DesCryptTests, OutIteratorUsageDecryptTest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Impl, typename InputIt>
|
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)
|
InputIt begin, InputIt end)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t> result;
|
std::vector<uint8_t> result;
|
||||||
@@ -522,7 +522,7 @@ TEST(DesCryptTests, EncryptThroughBaseTest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Impl>
|
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);
|
return enc.EncryptBlock(block);
|
||||||
}
|
}
|
||||||
@@ -541,7 +541,7 @@ TEST(DesCryptTests, EncryptUInt64BlockThroughBaseTest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Impl, typename InputIt>
|
template<typename Impl, typename InputIt>
|
||||||
static std::vector<uint8_t> DecryptThroughBase(Decryptor<Impl> & dec,
|
static std::vector<uint8_t> DecryptThroughBase(const Decryptor<Impl> & dec,
|
||||||
InputIt begin, InputIt end)
|
InputIt begin, InputIt end)
|
||||||
{
|
{
|
||||||
std::vector<uint8_t> result;
|
std::vector<uint8_t> result;
|
||||||
@@ -565,7 +565,7 @@ TEST(DesCryptTests, DecryptThroughBaseTest)
|
|||||||
}
|
}
|
||||||
|
|
||||||
template<typename Impl>
|
template<typename Impl>
|
||||||
static uint64_t DecryptUInt64BlockThroughBase(Decryptor<Impl> & dec, uint64_t block)
|
static uint64_t DecryptUInt64BlockThroughBase(const Decryptor<Impl> & dec, uint64_t block)
|
||||||
{
|
{
|
||||||
return dec.DecryptBlock(block);
|
return dec.DecryptBlock(block);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user