#include #include #include "dpf.hpp" /// Three-party comparison and interval-containment keys (one DCF share each). int main() { using Input = std::uint8_t; const Input thresh = 100; const std::uint64_t beta = 5; //! [eval-dpf3-cmp] auto [c1, c2, c3] = dpf::make_dpf3_cmp(thresh, beta); // Parties 1 and 3 hold the k0 half; party 2 holds k1. Open any complementary pair. const dpf::fp61 hot = dpf::reconstruct_cmp_halves(dpf::eval_point(c1, Input{10}), dpf::eval_point(c2, Input{10})); const dpf::fp61 cold = dpf::reconstruct_cmp_halves(dpf::eval_point(c3, Input{200}), dpf::eval_point(c2, Input{200})); //! [eval-dpf3-cmp] if (hot.raw() != beta || cold.raw() != 0) { std::cerr << "dpf3 cmp\n"; return 1; } //! [eval-dpf3-ic] auto [i1, i2, i3] = dpf::make_dpf3_ic(Input{10}, Input{20}, Input{40}, beta); // Interval is relative to the public shift `r`; x=35 is on for (20,40)@r=10. const dpf::fp61 inside = dpf::reconstruct_cmp_halves(dpf::eval_point(i1, Input{35}), dpf::eval_point(i2, Input{35})); //! [eval-dpf3-ic] if (inside.raw() != beta) { std::cerr << "dpf3 ic\n"; return 1; } std::cout << hot.raw() << "\n"; return 0; }