rippled
ripple
protocol
HashPrefix.h
1
//------------------------------------------------------------------------------
2
/*
3
This file is part of rippled: https://github.com/ripple/rippled
4
Copyright (c) 2012, 2013 Ripple Labs Inc.
5
6
Permission to use, copy, modify, and/or distribute this software for any
7
purpose with or without fee is hereby granted, provided that the above
8
copyright notice and this permission notice appear in all copies.
9
10
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17
*/
18
//==============================================================================
19
20
#ifndef RIPPLE_PROTOCOL_HASHPREFIX_H_INCLUDED
21
#define RIPPLE_PROTOCOL_HASHPREFIX_H_INCLUDED
22
23
#include <ripple/beast/hash/hash_append.h>
24
#include <
cstdint
>
25
26
namespace
ripple
{
27
28
namespace
detail {
29
30
constexpr
std::uint32_t
31
make_hash_prefix
(
char
a,
char
b,
char
c)
32
{
33
return
(
static_cast<
std::uint32_t
>
(a) << 24) +
34
(
static_cast<
std::uint32_t
>
(b) << 16) +
35
(
static_cast<
std::uint32_t
>
(c) << 8);
36
}
37
38
}
// namespace detail
39
54
enum class
HashPrefix
:
std::uint32_t
{
56
transactionID
=
detail::make_hash_prefix
(
'T'
,
'X'
,
'N'
),
57
59
txNode
=
detail::make_hash_prefix
(
'S'
,
'N'
,
'D'
),
60
62
leafNode
=
detail::make_hash_prefix
(
'M'
,
'L'
,
'N'
),
63
65
innerNode
=
detail::make_hash_prefix
(
'M'
,
'I'
,
'N'
),
66
68
ledgerMaster
=
detail::make_hash_prefix
(
'L'
,
'W'
,
'R'
),
69
71
txSign
=
detail::make_hash_prefix
(
'S'
,
'T'
,
'X'
),
72
74
txMultiSign
=
detail::make_hash_prefix
(
'S'
,
'M'
,
'T'
),
75
77
validation
=
detail::make_hash_prefix
(
'V'
,
'A'
,
'L'
),
78
80
proposal
=
detail::make_hash_prefix
(
'P'
,
'R'
,
'P'
),
81
83
manifest
=
detail::make_hash_prefix
(
'M'
,
'A'
,
'N'
),
84
86
paymentChannelClaim
=
detail::make_hash_prefix
(
'C'
,
'L'
,
'M'
),
87
89
shardInfo
=
detail::make_hash_prefix
(
'S'
,
'H'
,
'D'
),
90
};
91
92
template
<
class
Hasher>
93
void
94
hash_append
(Hasher& h,
HashPrefix
const
& hp) noexcept
95
{
96
using
beast::hash_append
;
97
hash_append
(h,
static_cast<
std::uint32_t
>
(hp));
98
}
99
100
}
// namespace ripple
101
102
#endif
ripple::HashPrefix::ledgerMaster
@ ledgerMaster
ledger master data for signing
ripple::HashPrefix::txNode
@ txNode
transaction plus metadata
ripple::HashPrefix::paymentChannelClaim
@ paymentChannelClaim
Payment Channel Claim.
ripple::HashPrefix::manifest
@ manifest
Manifest.
ripple::HashPrefix::txMultiSign
@ txMultiSign
inner transaction to multi-sign
ripple::HashPrefix::innerNode
@ innerNode
inner node in V1 tree
ripple::HashPrefix
HashPrefix
Prefix for hashing functions.
Definition:
HashPrefix.h:54
ripple::detail::make_hash_prefix
constexpr std::uint32_t make_hash_prefix(char a, char b, char c)
Definition:
HashPrefix.h:31
ripple::HashPrefix::proposal
@ proposal
proposal for signing
cstdint
ripple::HashPrefix::transactionID
@ transactionID
transaction plus signature to give transaction ID
ripple::HashPrefix::validation
@ validation
validation for signing
std::uint32_t
ripple::HashPrefix::leafNode
@ leafNode
account state
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition:
RCLCensorshipDetector.h:29
beast::hash_append
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.
Definition:
hash_append.h:236
ripple::HashPrefix::txSign
@ txSign
inner transaction to sign
ripple::hash_append
void hash_append(Hasher &h, ValidatorBlobInfo const &blobInfo)
Definition:
ValidatorList.h:897
ripple::HashPrefix::shardInfo
@ shardInfo
shard info for signing
Generated by
1.8.17