#include #include #include #include "dpf.hpp" #include "dpf/app_flow.hpp" #include "dpf/app_plans.hpp" // Three-server index PIR with the information-theoretic DPF // (ePrint 2023/028). The database is public and replicated. Each server // dots its additive share with the table; the three dots sum to the record. // make_dpf3 remains the computational (2,3) Shamir key. // // c++ -std=c++17 -march=native -I include -I thirdparty \ // examples/applications/it_pir3.cpp int main() { constexpr std::size_t n = 256; constexpr std::uint8_t index = 42; std::vector database(n); for (std::size_t i = 0; i < n; ++i) database[i] = i * i + 1; auto [k0, k1, k2] = dpf::make_it_dpf3(index, 1); const auto s0 = dpf::eval_it_dpf3_inner_product(k0, database); const auto s1 = dpf::eval_it_dpf3_inner_product(k1, database); const auto s2 = dpf::eval_it_dpf3_inner_product(k2, database); const auto opened = s0 + s1 + s2; if (opened != database[index]) { std::cerr << "it_pir3\n"; return 1; } { constexpr std::size_t query_bytes = dpf::it_dpf3_key::domain_size * sizeof(std::uint64_t); if (int rc = dpf::app::run_measured("it_pir3", dpf::protocol::n_server_pir_plan(0, 3, query_bytes, sizeof(std::uint64_t)), 2)) return rc; } std::cout << opened << "\n"; return 0; }