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>
36 lines
1.1 KiB
C++
36 lines
1.1 KiB
C++
#include <cstdint>
|
|
#include <iostream>
|
|
|
|
#include "dpf.hpp"
|
|
|
|
// Complete program. The parties already hold XOR shares of alpha.
|
|
// The pad stream is local here; a real protocol would draw it from a dealer
|
|
// who never sees alpha.
|
|
//
|
|
// c++ -std=c++17 -march=native -I include -I thirdparty examples/mwe/shared_index.cpp
|
|
int main()
|
|
{
|
|
const std::uint8_t alpha = 42;
|
|
const std::uint64_t beta = 7;
|
|
const std::uint8_t x0 = 7;
|
|
const std::uint8_t x1 = static_cast<std::uint8_t>(alpha ^ x0);
|
|
|
|
auto root = []() { return dpf::uniform_sample<simde__m128i>(); };
|
|
struct pad
|
|
{
|
|
simde__m128i block() { return dpf::uniform_sample<simde__m128i>(); }
|
|
std::uint8_t bit()
|
|
{
|
|
return static_cast<std::uint8_t>(dpf::uniform_sample<unsigned>() & 1u);
|
|
}
|
|
};
|
|
dpf::ds_randomness<decltype(root), pad> rng{root, {}};
|
|
|
|
auto keys = dpf::make_dpf_doerner_shelat(x0, x1, rng, beta);
|
|
const std::uint64_t opened = dpf::reconstruct(
|
|
*dpf::eval_point(keys.first, alpha),
|
|
*dpf::eval_point(keys.second, alpha));
|
|
|
|
std::cout << opened << "\n";
|
|
return opened == beta ? 0 : 1;
|
|
}
|