27 lines
766 B
C++
27 lines
766 B
C++
|
|
#include <cstdint>
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
#include "dpf.hpp"
|
||
|
|
|
||
|
|
// Complete program. A point-programmable vector commitment publishes the
|
||
|
|
// commitment before the hidden coordinate is chosen.
|
||
|
|
//
|
||
|
|
// c++ -std=c++17 -march=native -I include -I thirdparty examples/mwe/ppvc.cpp
|
||
|
|
int main()
|
||
|
|
{
|
||
|
|
using scheme = dpf::ppvc<std::uint8_t, 8>;
|
||
|
|
|
||
|
|
const auto pp = scheme::setup();
|
||
|
|
const auto [com, st] = scheme::commit(pp);
|
||
|
|
|
||
|
|
const std::uint8_t xi = 40;
|
||
|
|
const std::uint64_t tau = 0x5a;
|
||
|
|
const auto op = scheme::open(st, 0, tau, xi);
|
||
|
|
const auto x = scheme::eval(op);
|
||
|
|
const auto rotated = scheme::eval_rotated(op);
|
||
|
|
|
||
|
|
const bool ok = scheme::accept(pp, com, op, x, xi) && rotated[xi] == tau;
|
||
|
|
std::cout << rotated[xi] << "\n";
|
||
|
|
return ok ? 0 : 1;
|
||
|
|
}
|