23 for (
size_t i = 0; i < old_path.size(); ++i) {
24 bool path_bit =
static_cast<bool>(index & 0x1);
26 path[i].second = current;
28 path[i].first = current;
39 for (
size_t i = 0; i < tree_depth; ++i) {
48 std::transform(input.begin(), input.end(),
std::back_inserter(result), [&](
auto const& v) {
49 return std::make_pair(bb::stdlib::field_t(bb::stdlib::witness_t(&ctx, v.first)),
50 bb::stdlib::field_t(bb::stdlib::witness_t(&ctx, v.second)));
57 return hash_pair_native(input[input.size() - 1].first, input[input.size() - 1].second);
63 for (
size_t i = 0; i < height; ++i) {
74template <
typename Ctx>
78 for (
size_t i = 0;
i < path.size(); ++
i) {
79 os <<
" (" <<
i <<
": " << path[
i].first <<
", " << path[
i].second <<
")\n";
88 for (
size_t i = 0;
i < path.size(); ++
i) {
89 os <<
" (" <<
i <<
": " << path[
i].first <<
", " << path[
i].second <<
")\n";
std::vector< std::pair< bb::stdlib::field_t< Ctx >, bb::stdlib::field_t< Ctx > > > hash_path
hash_path< Ctx > create_witness_hash_path(Ctx &ctx, fr_hash_path const &input)
fr zero_hash_at_height(size_t height)
fr_hash_path get_random_hash_path(size_t const &tree_depth)
std::vector< std::pair< fr, fr > > fr_hash_path
std::vector< fr > fr_sibling_path
fr get_hash_path_root(fr_hash_path const &input)
fr_hash_path get_new_hash_path(fr_hash_path const &old_path, uint128_t index, fr const &value)
bb::fr hash_pair_native(bb::fr const &lhs, bb::fr const &rhs)
field< Bn254FrParams > fr
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::ostream & operator<<(std::ostream &os, const T &obj)
Automatically derived stream operator for any object that defines .msgpack() (implicitly defined by M...
unsigned __int128 uint128_t
static field random_element(numeric::RNG *engine=nullptr) noexcept