libdpf/examples/mwe/point.cpp

25 lines
714 B
C++
Raw Permalink Normal View History

#include <cstdint>
#include <iostream>
#include "dpf.hpp"
// Complete program. Leaf shares are subtractive: reconstruct is share0 - share1.
//
// c++ -std=c++17 -march=native -I include -I thirdparty examples/mwe/point.cpp
int main()
{
const std::uint8_t alpha = 42;
const std::uint64_t beta = 7;
auto [k0, k1] = dpf::make_dpf(alpha, beta);
const std::uint64_t at = dpf::reconstruct(
*dpf::eval_point(k0, alpha),
*dpf::eval_point(k1, alpha));
const std::uint64_t off = dpf::reconstruct(
*dpf::eval_point(k0, std::uint8_t{0}),
*dpf::eval_point(k1, std::uint8_t{0}));
std::cout << at << " " << off << "\n";
return (at == beta && off == 0) ? 0 : 1;
}