Add Padder<>. A CRTP base for padding algorithms.
All checks were successful
Chaos Ci / test-and-benchmark (push) Successful in 1m59s

This commit is contained in:
hashlag
2026-02-08 23:44:51 +03:00
parent 5baede0a1d
commit 797a5428cc
3 changed files with 58 additions and 1 deletions

View File

@@ -119,3 +119,25 @@ TEST(PadPkcs7Tests, PadOutIteratorUsageTest)
ASSERT_EQ(expected, fact);
}
}
template<typename Impl, typename OutputIt>
void PadThroughBase(const Padder<Impl> & padder, OutputIt begin, OutputIt end)
{
padder.Pad(begin, end);
}
TEST(PadPkcs7Tests, PadThroughBaseTest)
{
{
std::array<uint8_t, 5> fact = {};
std::array<uint8_t, 5> expected =
{
0x05, 0x05, 0x05, 0x05, 0x05
};
const PadderPkcs7 padder;
PadThroughBase(padder, fact.begin(), fact.end());
ASSERT_EQ(expected, fact);
}
}