rippled
Loading...
Searching...
No Matches
HashPrefix.h
1#ifndef XRPL_PROTOCOL_HASHPREFIX_H_INCLUDED
2#define XRPL_PROTOCOL_HASHPREFIX_H_INCLUDED
3
4#include <xrpl/beast/hash/hash_append.h>
5
6#include <cstdint>
7
8namespace ripple {
9
10namespace detail {
11
12constexpr std::uint32_t
13make_hash_prefix(char a, char b, char c)
14{
15 return (static_cast<std::uint32_t>(a) << 24) +
16 (static_cast<std::uint32_t>(b) << 16) +
17 (static_cast<std::uint32_t>(c) << 8);
18}
19
20} // namespace detail
21
39
41 txNode = detail::make_hash_prefix('S', 'N', 'D'),
42
44 leafNode = detail::make_hash_prefix('M', 'L', 'N'),
45
47 innerNode = detail::make_hash_prefix('M', 'I', 'N'),
48
51
53 txSign = detail::make_hash_prefix('S', 'T', 'X'),
54
57
59 validation = detail::make_hash_prefix('V', 'A', 'L'),
60
62 proposal = detail::make_hash_prefix('P', 'R', 'P'),
63
65 manifest = detail::make_hash_prefix('M', 'A', 'N'),
66
69
71 credential = detail::make_hash_prefix('C', 'R', 'D'),
72
74 batch = detail::make_hash_prefix('B', 'C', 'H'),
75};
76
77template <class Hasher>
78void
79hash_append(Hasher& h, HashPrefix const& hp) noexcept
80{
82 hash_append(h, static_cast<std::uint32_t>(hp));
83}
84
85} // namespace ripple
86
87#endif
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:13
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
void hash_append(Hasher &h, Slice const &v)
Definition Slice.h:180
HashPrefix
Prefix for hashing functions.
Definition HashPrefix.h:36
@ leafNode
account state
@ txSign
inner transaction to sign
@ txNode
transaction plus metadata
@ credential
Credentials signature.
@ 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.