Ship the TLS mesh, composer, Beaver/Yao/leaf MPC, prep/online paths, apps, and docs so the tree is pushable before elevating share_expr, security_mode, and prep resume. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
#include <cstdint>
|
|
#include <iostream>
|
|
|
|
#include "dpf.hpp"
|
|
|
|
/// Three-evaluator point DPF (ePrint 2024/1658 Fig. 3). Each key is a Shamir
|
|
/// share; open with any two (or all three) via `dpf::reconstruct`.
|
|
int main()
|
|
{
|
|
using Input = std::uint8_t;
|
|
const Input alpha = 42;
|
|
const dpf::fp61 beta{7};
|
|
|
|
//! [eval-dpf3-point]
|
|
auto [k1, k2, k3] = dpf::make_dpf3(alpha, beta);
|
|
const dpf::fp61 y1 = dpf::eval_point(k1, alpha);
|
|
const dpf::fp61 y2 = dpf::eval_point(k2, alpha);
|
|
const dpf::fp61 y3 = dpf::eval_point(k3, alpha);
|
|
const dpf::fp61 opened = dpf::reconstruct(
|
|
dpf::as_share(k1, y1), dpf::as_share(k2, y2), dpf::as_share(k3, y3));
|
|
//! [eval-dpf3-point]
|
|
if (opened != beta)
|
|
{
|
|
std::cerr << "dpf3 at the programmed input\n";
|
|
return 1;
|
|
}
|
|
|
|
const dpf::fp61 z1 = dpf::eval_point(k1, Input{41});
|
|
const dpf::fp61 z2 = dpf::eval_point(k2, Input{41});
|
|
const dpf::fp61 z3 = dpf::eval_point(k3, Input{41});
|
|
if (dpf::reconstruct(dpf::as_share(k1, z1), dpf::as_share(k2, z2),
|
|
dpf::as_share(k3, z3))
|
|
.raw()
|
|
!= 0)
|
|
{
|
|
std::cerr << "dpf3 off the programmed input\n";
|
|
return 1;
|
|
}
|
|
|
|
std::cout << opened.raw() << "\n";
|
|
return 0;
|
|
}
|