Document the new DPF surfaces in one command set, and test the field, half-tree, and multipoint edges.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
0d8a5a8131
commit
0dff6df8ed
250 changed files with 12199 additions and 1981 deletions
|
|
@ -243,3 +243,41 @@ TEST(ChachaPrg, ExpandAndBufferedReplay)
|
|||
EXPECT_EQ(replay.get<0>(), s0);
|
||||
EXPECT_NE(s0, streamed.get<0>());
|
||||
}
|
||||
|
||||
template <typename PRG>
|
||||
void expect_chacha_comparison_and_interval()
|
||||
{
|
||||
const std::uint8_t alpha = 0x3C;
|
||||
auto [c0, c1] = dpf::make_dpf<PRG>(alpha, dpf::lt(std::uint32_t{7}, std::uint32_t{1}));
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
const auto x = static_cast<std::uint8_t>(i);
|
||||
const auto got = dpf::reconstruct(
|
||||
dpf::eval_point(dpf::cmp, c0, x),
|
||||
dpf::eval_point(dpf::cmp, c1, x));
|
||||
EXPECT_EQ(static_cast<std::uint64_t>(got) & 0xffffffffu,
|
||||
x < alpha ? 7u : 1u)
|
||||
<< "x=" << i;
|
||||
}
|
||||
|
||||
const std::uint8_t r = 9, p = 2, q = 5;
|
||||
auto keys = dpf::make_dpf<PRG>(r, dpf::ic(p, q, std::uint32_t{4}, std::uint32_t{1}));
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
const auto x = static_cast<std::uint8_t>(i);
|
||||
const auto got = dpf::reconstruct(
|
||||
dpf::eval_point(dpf::ic, keys.first, x),
|
||||
dpf::eval_point(dpf::ic, keys.second, x));
|
||||
const auto w = static_cast<std::uint8_t>(x - r);
|
||||
EXPECT_EQ(static_cast<std::uint64_t>(got) & 0xffffffffu,
|
||||
(w >= p && w <= q) ? 4u : 1u)
|
||||
<< "x=" << i;
|
||||
}
|
||||
}
|
||||
|
||||
TEST(ChachaPrg, ComparisonAndIntervalKeys)
|
||||
{
|
||||
expect_chacha_comparison_and_interval<dpf::prg::chacha20>();
|
||||
expect_chacha_comparison_and_interval<dpf::prg::chacha12>();
|
||||
expect_chacha_comparison_and_interval<dpf::prg::chacha8>();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue