25 void hash256aux(
HexMap const& _s, HexMap::const_iterator _begin, HexMap::const_iterator _end,
unsigned _preLen, RLPStream& _rlp);
31 else if (std::next(_begin) == _end)
40 unsigned sharedPre = (unsigned)-1;
42 for (
auto i = std::next(_begin); i != _end && sharedPre; ++i, ++c)
44 unsigned x = std::min(sharedPre, std::min((
unsigned)_begin->first.size(), (unsigned)i->first.size()));
45 unsigned shared = _preLen;
46 for (; shared < x && _begin->first[shared] == i->first[shared]; ++shared) {}
47 sharedPre = std::min(shared, sharedPre);
49 if (sharedPre > _preLen)
53 hash256aux(_s, _begin, _end, (
unsigned)sharedPre, _rlp);
60 if (_preLen == b->first.size())
62 for (
auto i = 0; i < 16; ++i)
65 for (; n != _end && n->first[_preLen] == i; ++n) {}
72 if (_preLen == _begin->first.size())
73 _rlp << _begin->second;
85 if (
rlp.out().size() < 32)
100 for (
auto i = _s.rbegin(); i != _s.rend(); ++i)
103 hash256rlp(hexMap, hexMap.cbegin(), hexMap.cend(), 0, s);
126 m[
rlp(j++)] = i.toBytes();
std::map< bytes, bytes > BytesMap
bytes rlp(_T _t)
Export a single item in RLP format, returning a byte array.
std::string hexPrefixEncode(bytes const &_hexVector, bool _leaf, int _begin, int _end)
bool sha3(bytesConstRef _input, bytesRef o_output) noexcept
void hash256rlp(HexMap const &_s, HexMap::const_iterator _begin, HexMap::const_iterator _end, unsigned _preLen, RLPStream &_rlp)
h256 hash256(BytesMap const &_s)
std::vector< byte > bytes
vector_ref< byte const > bytesConstRef
RLPStream & appendList(size_t _items)
Appends a list.
bytes asNibbles(bytesConstRef const &_s)
std::map< bytes, bytes > HexMap
bytes rlp256(BytesMap const &_s)
h256 orderedTrieRoot(std::vector< bytes > const &_data)
Class for writing to an RLP bytestream.
RLPStream & appendRaw(bytesConstRef _rlp, size_t _itemCount=1)
Appends raw (pre-serialised) RLP data. Use with caution.
void hash256aux(HexMap const &_s, HexMap::const_iterator _begin, HexMap::const_iterator _end, unsigned _preLen, RLPStream &_rlp)