Wildmeshing Toolkit
merkle_tree.cpp
Go to the documentation of this file.
1 
2 #include "merkle_tree.hpp"
3 #include "Hashable.hpp"
5 namespace wmtk::utils {
7 {
9  for (const auto& [name, hash] : hashable.child_hashes()) {
10  js[name] = hash;
11  }
12 
13  if (auto merkle_ptr = dynamic_cast<const MerkleTreeInteriorNode*>(&hashable);
14  merkle_ptr != nullptr) {
15  for (const auto& [name, hashable_ptr] : merkle_ptr->child_hashables()) {
16  js[name] = merkle_tree(*hashable_ptr);
17  }
18  }
19  return js;
20 }
21 } // namespace wmtk::utils
virtual std::map< std::string, size_t > child_hashes() const
Definition: Hashable.cpp:32
nlohmann::json merkle_tree(const Hashable &hashable)
Definition: merkle_tree.cpp:6
nlohmann::json json
Definition: input.cpp:9