20 #include <ripple/basics/Log.h>
21 #include <ripple/beast/core/LexicalCast.h>
22 #include <ripple/crypto/csprng.h>
23 #include <ripple/shamap/SHAMapNodeID.h>
24 #include <boost/format.hpp>
33 enum { mask_size = 65 };
42 for (
int i = 0; i < mask_size - 1; i += 2)
45 *(selector.
begin() + (i / 2)) = 0xF0;
46 entry[i + 1] = selector;
47 *(selector.
begin() + (i / 2)) = 0xFF;
49 entry[mask_size - 1] = selector;
52 static masks_t
const masks;
53 return masks.entry[depth];
58 : mNodeID(hash), mDepth(depth)
60 assert((depth >= 0) && (depth < 65));
71 mDepth = *(
static_cast<unsigned char const*
>(ptr) + 32);
79 return "NodeID(root)";
103 assert((m >= 0) && (m < 16));
107 child.begin()[
mDepth / 2] |= (
mDepth & 1) ? m : (m << 4);
123 assert((branch >= 0) && (branch < 16));
134 for (
unsigned i = 0; i <
mDepth / 2; ++i, ++x, ++y)
int selectBranch(uint256 const &hash) const
SHAMapNodeID getChildNodeID(int m) const
std::string getString() const
int add8(unsigned char i)
std::string to_string(ListDisposition disposition)
std::string getRawString() const
A generic endpoint for log messages.
void addIDRaw(Serializer &s) const
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
int addBitString(base_uint< Bits, Tag > const &v)
std::string getString() const
static uint256 const & Masks(int depth)
void dump(beast::Journal journal) const
bool has_common_prefix(SHAMapNodeID const &other) const