rippled
Loading...
Searching...
No Matches
HashPrefix.h
1#pragma once
2
3#include <xrpl/beast/hash/hash_append.h>
4
5#include <cstdint>
6
7namespace xrpl {
8
9namespace detail {
10
11constexpr std::uint32_t
12make_hash_prefix(char a, char b, char c)
13{
14 return (static_cast<std::uint32_t>(a) << 24) + (static_cast<std::uint32_t>(b) << 16) +
15 (static_cast<std::uint32_t>(c) << 8);
16}
17
18} // namespace detail
19
37
39 txNode = detail::make_hash_prefix('S', 'N', 'D'),
40
42 leafNode = detail::make_hash_prefix('M', 'L', 'N'),
43
45 innerNode = detail::make_hash_prefix('M', 'I', 'N'),
46
49
51 txSign = detail::make_hash_prefix('S', 'T', 'X'),
52
55
57 validation = detail::make_hash_prefix('V', 'A', 'L'),
58
60 proposal = detail::make_hash_prefix('P', 'R', 'P'),
61
63 manifest = detail::make_hash_prefix('M', 'A', 'N'),
64
67
69 batch = detail::make_hash_prefix('B', 'C', 'H'),
70};
71
72template <class Hasher>
73void
74hash_append(Hasher& h, HashPrefix const& hp) noexcept
75{
77 hash_append(h, static_cast<std::uint32_t>(hp));
78}
79
80} // namespace xrpl
std::enable_if_t< is_contiguously_hashable< T, Hasher >::value > hash_append(Hasher &h, T const &t) noexcept
Logically concatenate input data to a Hasher.
constexpr std::uint32_t make_hash_prefix(char a, char b, char c)
Definition HashPrefix.h:12
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
void hash_append(Hasher &h, Slice const &v)
Definition Slice.h:174
HashPrefix
Prefix for hashing functions.
Definition HashPrefix.h:34
@ leafNode
account state
@ txSign
inner transaction to sign
@ txNode
transaction plus metadata
@ manifest
Manifest.
@ ledgerMaster
ledger master data for signing
@ txMultiSign
inner transaction to multi-sign
@ transactionID
transaction plus signature to give transaction ID
@ validation
validation for signing
@ proposal
proposal for signing
@ innerNode
inner node in V1 tree
@ paymentChannelClaim
Payment Channel Claim.