Add point-programmable vector commitments.
A commitment can be published before its hidden coordinate is chosen. Opening one side of each aligned 1-bit DPF pair sets that coordinate or the vector sum, and a shift moves it onto a public index. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
fff543ad48
commit
cf8054a0b3
9 changed files with 1308 additions and 1 deletions
26
examples/mwe/ppvc.cpp
Normal file
26
examples/mwe/ppvc.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue