libdpf/examples/applications/pirsona_fetch.cpp
Ryan Henry 0d22946a0e Checkpoint the party/runtime stack before share-program and malicious-mode work.
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>
2026-09-28 05:59:19 -06:00

42 lines
1.3 KiB
C++

#include <cstdint>
#include <iostream>
#include <memory>
#include <vector>
#include "dpf/online_session.hpp"
// PIRsona BitMore fetch on a split-io async star (L=1 → 2 servers).
//
// c++ -std=c++17 -pthread -I include -I thirdparty \
// examples/applications/pirsona_fetch.cpp
int main()
{
constexpr std::size_t L = 1;
constexpr std::size_t n = 1u << L;
auto seeds = std::make_shared<std::vector<std::vector<std::uint8_t>>>(n);
auto answers = std::make_shared<std::vector<std::vector<std::uint8_t>>>(n);
for (std::size_t i = 0; i < n; ++i)
{
(*seeds)[i].assign(16 * L, static_cast<std::uint8_t>(i + 1));
(*answers)[i].assign(8, static_cast<std::uint8_t>(0x40 + i));
}
try
{
auto client = dpf::protocol::pirsona_bitmore_fetch(L, 16, 8, seeds, answers);
const std::vector<std::size_t> slots{16u * L, 8u};
dpf::session::drive_async_star(n, slots, std::move(client),
[&](std::size_t i) {
return dpf::protocol::star_server_reply_rounds(16 * L, 8,
(*answers)[i]);
});
std::cout << "pirsona_fetch rounds=" << (2 * n) << " servers=" << n
<< "\n";
}
catch (const std::exception & ex)
{
std::cerr << "pirsona_fetch: " << ex.what() << "\n";
return 1;
}
return 0;
}