mirror of
https://github.com/Xahau/xahaud.git
synced 2026-07-28 17:40:10 +00:00
* Replace custom types with C++11 <cstdint> types * Fix sqlite integer intos and uses * Fix String implicit integer constructors * Escape the enclosing namespace in sqdb * Replace contract checks with assert * Make many header files compile independently * Remove the dependence on beast_core.h in many places * Remove unused or obsolete classes and functions * Remove unused or obsolete macros * Remove unused network functions and files * Remove unused or obsolete classes: - ChildProcess - HighResolutionTimer - InterProcessLock - Throw - TrackedMutex - UntrackedMutex - XmlDocument - XmlElement
92 lines
2.7 KiB
C++
92 lines
2.7 KiB
C++
//------------------------------------------------------------------------------
|
|
/*
|
|
This file is part of rippled: https://github.com/ripple/rippled
|
|
Copyright (c) 2012, 2013 Ripple Labs Inc.
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
*/
|
|
//==============================================================================
|
|
|
|
#ifndef RIPPLE_HASHPREFIX_H
|
|
#define RIPPLE_HASHPREFIX_H
|
|
|
|
namespace ripple {
|
|
|
|
/** Prefix for hashing functions.
|
|
|
|
These prefixes are inserted before the source material used to generate
|
|
various hashes. This is done to put each hash in its own "space." This way,
|
|
two different types of objects with the same binary data will produce
|
|
different hashes.
|
|
|
|
Each prefix is a 4-byte value with the last byte set to zero and the first
|
|
three bytes formed from the ASCII equivalent of some arbitrary string. For
|
|
example "TXN".
|
|
|
|
@note Hash prefixes are part of the Ripple protocol.
|
|
|
|
@ingroup protocol
|
|
*/
|
|
class HashPrefix
|
|
{
|
|
private:
|
|
std::uint32_t m_prefix;
|
|
|
|
public:
|
|
HashPrefix (char a, char b, char c)
|
|
: m_prefix (0)
|
|
{
|
|
m_prefix = a;
|
|
m_prefix = (m_prefix << 8) + b;
|
|
m_prefix = (m_prefix << 8) + c;
|
|
m_prefix = m_prefix << 8;
|
|
}
|
|
|
|
/** Returns the hash prefix associated with this object */
|
|
operator std::uint32_t () const
|
|
{
|
|
return m_prefix;
|
|
}
|
|
|
|
// VFALCO TODO Expand the description to complete, concise sentences.
|
|
//
|
|
|
|
/** transaction plus signature to give transaction ID */
|
|
static HashPrefix const transactionID;
|
|
|
|
/** transaction plus metadata */
|
|
static HashPrefix const txNode;
|
|
|
|
/** account state */
|
|
static HashPrefix const leafNode;
|
|
|
|
/** inner node in tree */
|
|
static HashPrefix const innerNode;
|
|
|
|
/** ledger master data for signing */
|
|
static HashPrefix const ledgerMaster;
|
|
|
|
/** inner transaction to sign */
|
|
static HashPrefix const txSign;
|
|
|
|
/** validation for signing */
|
|
static HashPrefix const validation;
|
|
|
|
/** proposal for signing */
|
|
static HashPrefix const proposal;
|
|
};
|
|
|
|
} // ripple
|
|
|
|
#endif
|