Equity
Bitcoin Protocol Library
|
A Merkle Tree with some idiosyncracies specific to Bitcoin. More...
#include <MerkleTree.h>
Public Member Functions | |
MerkleTree (Crypto::Sha256HashList const &hashes) | |
Crypto::Sha256Hash | root () const |
Returns the root. | |
Crypto::Sha256Hash | hashAt (size_t i) const |
Returns the hash at the given index. More... | |
Crypto::Sha256HashList | proof (size_t i) const |
Returns a proof for the hash at the given index. More... | |
Static Public Member Functions | |
static bool | verify (Crypto::Sha256Hash const &hash, size_t i, Crypto::Sha256HashList const &proof, Crypto::Sha256Hash const &root) |
Verifies that the given hash is the hash at the given index, given a proof and a root. More... | |
A Merkle Tree with some idiosyncracies specific to Bitcoin.
Utility::MerkleTree::MerkleTree | ( | Crypto::Sha256HashList const & | hashes | ) |
hashes | ordered list of hashes |
Crypto::Sha256Hash Utility::MerkleTree::hashAt | ( | size_t | i | ) | const |
Returns the hash at the given index.
i | index |
Crypto::Sha256HashList Utility::MerkleTree::proof | ( | size_t | i | ) | const |
Returns a proof for the hash at the given index.
i | index |
|
static |
Verifies that the given hash is the hash at the given index, given a proof and a root.
hash | hash to verify |
i | location of the hash |
proof | list of hashes in depth-first order used to verify the hash |
root | root value that should be the result of the proof |