CatapultServer  v0.5.0.1 (Elephant)
MerkleHashBuilder.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "catapult/types.h"
23 #include <vector>
24 
25 namespace catapult { namespace crypto {
26 
29  public:
31  explicit MerkleHashBuilder(size_t capacity = 0);
32 
33  public:
35  void update(const Hash256& hash);
36 
38  void final(Hash256& hash);
39 
41  void final(std::vector<Hash256>& tree);
42 
43  public:
45  static size_t TreeSize(size_t leafCount);
46 
47  private:
48  std::vector<Hash256> m_hashes;
49  };
50 }}
catapult::Hash256
utils::ByteArray< Hash256_Size, Hash256_tag > Hash256
Definition: src/catapult/types.h:47
catapult::crypto::Sha3_256
void Sha3_256(const RawBuffer &dataBuffer, Hash256 &hash) noexcept
Calculates the 256-bit SHA3 hash of dataBuffer into hash.
Definition: Hashes.cpp:81
MerkleHashBuilder.h
catapult::crypto::MerkleHashBuilder::m_hashes
std::vector< Hash256 > m_hashes
Definition: MerkleHashBuilder.h:48
catapult::crypto::Sha3_256_Builder
KeccakBuilder< Sha3ModeTag, Hash256_tag > Sha3_256_Builder
Sha3_256_Builder.
Definition: Hashes.h:85
functions.h
catapult::crypto::MerkleHashBuilder
Builder for creating a merkle hash.
Definition: MerkleHashBuilder.h:28
Hashes.h
catapult::crypto::MerkleHashBuilder::update
void update(const Hash256 &hash)
Adds hash to the merkle hash.
Definition: MerkleHashBuilder.cpp:72
size
uint64_t size
Definition: MemoryCounters.cpp:65
catapult::crypto::MerkleHashBuilder::MerkleHashBuilder
MerkleHashBuilder(size_t capacity=0)
Creates a new merkle hash builder with the specified initial capacity.
Definition: MerkleHashBuilder.cpp:68
types.h
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::Hash256_Size
constexpr size_t Hash256_Size
Definition: src/catapult/types.h:34
catapult::crypto::MerkleHashBuilder::TreeSize
static size_t TreeSize(size_t leafCount)
Calculates the number of nodes in a merkle tree with leafCount leaves.
Definition: MerkleHashBuilder.cpp:90
catapult::utils::ByteArray< Hash256_Size, Hash256_tag >
catapult::crypto::MerkleHashBuilder::final
void final(Hash256 &hash)
Finalizes the merkle hash into hash.
Definition: MerkleHashBuilder.cpp:76