20#include <xrpl/beast/core/LexicalCast.h> 
   21#include <xrpl/beast/utility/instrumentation.h> 
   22#include <xrpl/protocol/Serializer.h> 
   23#include <xrpl/shamap/SHAMap.h> 
   24#include <xrpl/shamap/SHAMapNodeID.h> 
   31    enum { mask_size = 65 };
 
   40            for (
int i = 0; i < mask_size - 1; i += 2)
 
   43                *(selector.
begin() + (i / 2)) = 0xF0;
 
   44                entry[i + 1] = selector;
 
   45                *(selector.
begin() + (i / 2)) = 0xFF;
 
   47            entry[mask_size - 1] = selector;
 
   51    static masks_t 
const masks;
 
   52    return masks.entry[depth];
 
 
   57    : id_(hash), depth_(depth)
 
   61        "ripple::SHAMapNodeID::SHAMapNodeID : maximum depth input");
 
   64        "ripple::SHAMapNodeID::SHAMapNodeID : hash and depth inputs do match");
 
 
   81        "ripple::SHAMapNodeID::getChildNodeID : valid branch input");
 
   93        "ripple::SHAMapNodeID::getChildNodeID : maximum leaf depth");
 
   96        Throw<std::logic_error>(
 
   97            "Request for child node ID of " + 
to_string(*
this));
 
  100        Throw<std::logic_error>(
"Incorrect mask for " + 
to_string(*
this));
 
 
  114        unsigned int depth = *(
static_cast<unsigned char const*
>(data) + 32);
 
 
  127[[nodiscard]] 
unsigned int 
  130    auto const depth = 
id.getDepth();
 
  131    auto branch = 
static_cast<unsigned int>(*(hash.
begin() + (depth / 2)));
 
 
  147        (depth >= 0) && (depth < 65),
 
  148        "ripple::SHAMapNodeID::createID : valid branch input");
 
 
Identifies a node inside a SHAMap.
 
SHAMapNodeID getChildNodeID(unsigned int m) const
 
std::string getRawString() const
 
static SHAMapNodeID createID(int depth, uint256 const &key)
Create a SHAMapNodeID of a node with the depth of the node and the key of a leaf.
 
static constexpr unsigned int leafDepth
The depth of the hash map: data is only present in the leaves.
 
static constexpr unsigned int branchFactor
Number of children each non-leaf node has (the 'radix tree' part of the map)
 
int addBitString(base_uint< Bits, Tag > const &v)
 
int add8(unsigned char i)
 
std::string getString() const
 
static base_uint fromVoid(void const *data)
 
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
 
std::optional< SHAMapNodeID > deserializeSHAMapNodeID(void const *data, std::size_t size)
Return an object representing a serialized SHAMap Node ID.
 
static uint256 const & depthMask(unsigned int depth)
 
unsigned int selectBranch(SHAMapNodeID const &id, uint256 const &hash)
Returns the branch that would contain the given hash.
 
std::string to_string(base_uint< Bits, Tag > const &a)