Add SimpleIdentifier traits for non-crypto identifiers

This commit is contained in:
Vinnie Falco
2013-09-23 12:40:35 -07:00
parent 3518a51d4a
commit 426636f48d
31 changed files with 459 additions and 168 deletions

View File

@@ -130,7 +130,7 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\ripple\types\impl\RippleCryptoIdentifierTests.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\RippleIdentifierTests.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -1614,17 +1614,19 @@
<ClInclude Include="..\..\src\ripple\types\api\base_uint.h" /> <ClInclude Include="..\..\src\ripple\types\api\base_uint.h" />
<ClInclude Include="..\..\src\ripple\types\api\Blob.h" /> <ClInclude Include="..\..\src\ripple\types\api\Blob.h" />
<ClInclude Include="..\..\src\ripple\types\api\ByteOrder.h" /> <ClInclude Include="..\..\src\ripple\types\api\ByteOrder.h" />
<ClInclude Include="..\..\src\ripple\types\api\CryptoIdentifierStorage.h" /> <ClInclude Include="..\..\src\ripple\types\api\IdentifierStorage.h" />
<ClInclude Include="..\..\src\ripple\types\api\CryptoIdentifierType.h" /> <ClInclude Include="..\..\src\ripple\types\api\IdentifierType.h" />
<ClInclude Include="..\..\src\ripple\types\api\HashMaps.h" /> <ClInclude Include="..\..\src\ripple\types\api\HashMaps.h" />
<ClInclude Include="..\..\src\ripple\types\api\RandomNumbers.h" /> <ClInclude Include="..\..\src\ripple\types\api\RandomNumbers.h" />
<ClInclude Include="..\..\src\ripple\types\api\RippleAccountID.h" /> <ClInclude Include="..\..\src\ripple\types\api\RippleAccountID.h" />
<ClInclude Include="..\..\src\ripple\types\api\RippleAccountPrivateKey.h" /> <ClInclude Include="..\..\src\ripple\types\api\RippleAccountPrivateKey.h" />
<ClInclude Include="..\..\src\ripple\types\api\RippleAccountPublicKey.h" /> <ClInclude Include="..\..\src\ripple\types\api\RippleAccountPublicKey.h" />
<ClInclude Include="..\..\src\ripple\types\api\RippleCryptoIdentifier.h" /> <ClInclude Include="..\..\src\ripple\types\api\CryptoIdentifier.h" />
<ClInclude Include="..\..\src\ripple\types\api\RippleLedgerHash.h" />
<ClInclude Include="..\..\src\ripple\types\api\RipplePrivateKey.h" /> <ClInclude Include="..\..\src\ripple\types\api\RipplePrivateKey.h" />
<ClInclude Include="..\..\src\ripple\types\api\RipplePublicKey.h" /> <ClInclude Include="..\..\src\ripple\types\api\RipplePublicKey.h" />
<ClInclude Include="..\..\src\ripple\types\api\RipplePublicKeyHash.h" /> <ClInclude Include="..\..\src\ripple\types\api\RipplePublicKeyHash.h" />
<ClInclude Include="..\..\src\ripple\types\api\SimpleIdentifier.h" />
<ClInclude Include="..\..\src\ripple\types\api\strHex.h" /> <ClInclude Include="..\..\src\ripple\types\api\strHex.h" />
<ClInclude Include="..\..\src\ripple\types\api\UInt128.h" /> <ClInclude Include="..\..\src\ripple\types\api\UInt128.h" />
<ClInclude Include="..\..\src\ripple\types\api\UInt160.h" /> <ClInclude Include="..\..\src\ripple\types\api\UInt160.h" />

View File

@@ -1056,7 +1056,7 @@
<ClCompile Include="..\..\src\ripple_app\peers\PackedMessage.cpp"> <ClCompile Include="..\..\src\ripple_app\peers\PackedMessage.cpp">
<Filter>[2] Old Ripple\ripple_app\peers</Filter> <Filter>[2] Old Ripple\ripple_app\peers</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\ripple\types\impl\RippleCryptoIdentifierTests.cpp"> <ClCompile Include="..\..\src\ripple\types\impl\RippleIdentifierTests.cpp">
<Filter>[1] Ripple\types\impl</Filter> <Filter>[1] Ripple\types\impl</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
@@ -2085,15 +2085,6 @@
<ClInclude Include="..\..\src\ripple\types\api\RipplePublicKeyHash.h"> <ClInclude Include="..\..\src\ripple\types\api\RipplePublicKeyHash.h">
<Filter>[1] Ripple\types\api</Filter> <Filter>[1] Ripple\types\api</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\CryptoIdentifierType.h">
<Filter>[1] Ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RippleCryptoIdentifier.h">
<Filter>[1] Ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\CryptoIdentifierStorage.h">
<Filter>[1] Ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RippleAccountID.h"> <ClInclude Include="..\..\src\ripple\types\api\RippleAccountID.h">
<Filter>[1] Ripple\types\api</Filter> <Filter>[1] Ripple\types\api</Filter>
</ClInclude> </ClInclude>
@@ -2106,6 +2097,21 @@
<ClInclude Include="..\..\src\ripple\types\api\RippleAccountPublicKey.h"> <ClInclude Include="..\..\src\ripple\types\api\RippleAccountPublicKey.h">
<Filter>[1] Ripple\types\api</Filter> <Filter>[1] Ripple\types\api</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\RippleLedgerHash.h">
<Filter>[1] Ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\IdentifierStorage.h">
<Filter>[1] Ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\IdentifierType.h">
<Filter>[1] Ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\SimpleIdentifier.h">
<Filter>[1] Ripple\types\api</Filter>
</ClInclude>
<ClInclude Include="..\..\src\ripple\types\api\CryptoIdentifier.h">
<Filter>[1] Ripple\types\api</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CustomBuild Include="..\..\src\ripple_data\protocol\ripple.proto"> <CustomBuild Include="..\..\src\ripple_data\protocol\ripple.proto">

View File

@@ -3,11 +3,14 @@ RIPPLE TODO
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Vinnie's List: Changes day to day, descending priority Vinnie's List: Changes day to day, descending priority
- Finish RPCAsyncServer, RPCService and RPCService::Manager
- Fix and tidy up broken beast classes
- Parse Validator line using cribbed code - Parse Validator line using cribbed code
- Parse ContentBodyBuffer from HTTPResponse - Parse ContentBodyBuffer from HTTPResponse
- Look into using CMake - HTTPMessage improvements
- HTTPClient improvements based on HTTPServer
- Ditch old HTTPClient so I can take the name
- Finish RPCAsyncServer, RPCService and RPCService::Manager
- Fix and tidy up broken beast classes
- Fix RPCDoor to respect config setting for [rpc_secure]
- Validators should delay the application of newly downloaded lists from - Validators should delay the application of newly downloaded lists from
sources, to mitigate the effects of attacks. Unless there's no validators sources, to mitigate the effects of attacks. Unless there's no validators
in the list. in the list.
@@ -15,9 +18,7 @@ Vinnie's List: Changes day to day, descending priority
manually revisit sources, etc... manually revisit sources, etc...
- Clean up calculation of COnfig file location. - Clean up calculation of COnfig file location.
- Remove TESTNET and all related code and settings. - Remove TESTNET and all related code and settings.
- Fix RPCDoor to respect config setting for [rpc_secure]
- Remove addRpcSub, findRpcSub, and notify the appropriate partner(s) - Remove addRpcSub, findRpcSub, and notify the appropriate partner(s)
- Make RPCHandler/Server asynchronous
David Features: David Features:
- override config items from command line - override config items from command line
@@ -25,6 +26,8 @@ David Features:
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Look into using CMake
- IPv6 support in IPEndpoint - IPv6 support in IPEndpoint
- Configuration list for Jenkins - Configuration list for Jenkins

View File

@@ -4,8 +4,8 @@
*/ */
//============================================================================== //==============================================================================
#ifndef RIPPLE_TYPES_RIPPLECRYPTOIDENTIFIER_H_INCLUDED #ifndef RIPPLE_TYPES_CRYPTOIDENTIFIER_H_INCLUDED
#define RIPPLE_TYPES_RIPPLECRYPTOIDENTIFIER_H_INCLUDED #define RIPPLE_TYPES_CRYPTOIDENTIFIER_H_INCLUDED
#include "beast/beast/FixedArray.h" #include "beast/beast/FixedArray.h"
#include "beast/beast/intrusive/IntrusiveArray.h" #include "beast/beast/intrusive/IntrusiveArray.h"
@@ -13,11 +13,11 @@
#include "Base58.h" #include "Base58.h"
#include "CryptoIdentifierStorage.h" #include "IdentifierStorage.h"
namespace ripple { namespace ripple {
/** Shared CryptoIdentifierType traits for Ripple crypto identifiers. /** Shared IdentifierType traits for Ripple crypto identifiers.
@tparam Size The number of bytes in the identifier, exclusive of version, @tparam Size The number of bytes in the identifier, exclusive of version,
checksum, or padding. checksum, or padding.
@@ -30,7 +30,7 @@ namespace ripple {
the data including the Token. the data including the Token.
*/ */
template <std::size_t Size, uint8 Token, bool Checked> template <std::size_t Size, uint8 Token, bool Checked>
class RippleCryptoIdentifier class CryptoIdentifier
{ {
public: public:
typedef std::size_t size_type; typedef std::size_t size_type;
@@ -44,7 +44,7 @@ public:
static bool const checked = Checked; static bool const checked = Checked;
// This is what the wrapper creates, it includes the padding. // This is what the wrapper creates, it includes the padding.
typedef CryptoIdentifierStorage < typedef IdentifierStorage <
pre_size, size, post_size> value_type; pre_size, size, post_size> value_type;
typedef typename value_type::hasher hasher; typedef typename value_type::hasher hasher;
@@ -69,7 +69,7 @@ public:
} }
} }
/** Base class for CryptoIdentifierType. */ /** Base class for IdentifierType. */
class base class base
{ {
public: public:

View File

@@ -4,16 +4,16 @@
*/ */
//============================================================================== //==============================================================================
#ifndef RIPPLE_TYPES_CRYPTOIDENTIFIERSTORAGE_H_INCLUDED #ifndef RIPPLE_TYPES_IDENTIFIERSTORAGE_H_INCLUDED
#define RIPPLE_TYPES_CRYPTOIDENTIFIERSTORAGE_H_INCLUDED #define RIPPLE_TYPES_IDENTIFIERSTORAGE_H_INCLUDED
#include "beast/beast/FixedArray.h" #include "beast/beast/FixedArray.h"
namespace ripple { namespace ripple {
/** A padded FixedArray used with CryptoIdentifierType traits. */ /** A padded FixedArray used with IdentifierType traits. */
template <std::size_t PreSize, std::size_t Size, std::size_t PostSize> template <std::size_t PreSize, std::size_t Size, std::size_t PostSize>
class CryptoIdentifierStorage class IdentifierStorage
{ {
public: public:
typedef std::size_t size_type; typedef std::size_t size_type;
@@ -43,7 +43,7 @@ public:
{ {
} }
std::size_t operator() (CryptoIdentifierStorage const& storage) const std::size_t operator() (IdentifierStorage const& storage) const
{ {
std::size_t hash; std::size_t hash;
Murmur::Hash (storage.cbegin (), storage.size, m_seed, &hash); Murmur::Hash (storage.cbegin (), storage.size, m_seed, &hash);
@@ -58,8 +58,8 @@ public:
class equal class equal
{ {
public: public:
bool operator() (CryptoIdentifierStorage const& lhs, bool operator() (IdentifierStorage const& lhs,
CryptoIdentifierStorage const& rhs) const IdentifierStorage const& rhs) const
{ {
return lhs == rhs; return lhs == rhs;
} }
@@ -115,7 +115,20 @@ public:
void rangecheck (size_type i) void rangecheck (size_type i)
{ {
if (i >= size) if (i >= size)
throw std::out_of_range ("CryptoIdentifierStorage<>: index out of range"); throw std::out_of_range ("IdentifierStorage<>: index out of range");
}
bool isZero() const
{
for (const_iterator iter(begin()); iter != end(); ++iter)
if ((*iter)!=0)
return false;
return true;
}
bool isNotZero() const
{
return !isZero();
} }
private: private:
@@ -125,43 +138,43 @@ private:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize> template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize>
bool operator== (CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs, bool operator== (IdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs,
CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs) IdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs)
{ {
return std::equal (lhs.begin(), lhs.end(), rhs.begin()); return std::equal (lhs.begin(), lhs.end(), rhs.begin());
} }
template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize> template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize>
bool operator!= (CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs, bool operator!= (IdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs,
CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs) IdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs)
{ {
return !(lhs==rhs); return !(lhs==rhs);
} }
template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize> template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize>
bool operator< (CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs, bool operator< (IdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs,
CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs) IdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs)
{ {
return std::lexicographical_compare (lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); return std::lexicographical_compare (lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
} }
template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize> template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize>
bool operator> (CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs, bool operator> (IdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs,
CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs) IdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs)
{ {
return rhs<lhs; return rhs<lhs;
} }
template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize> template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize>
bool operator<= (CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs, bool operator<= (IdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs,
CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs) IdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs)
{ {
return !(rhs<lhs); return !(rhs<lhs);
} }
template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize> template <std::size_t PrePadSize, std::size_t Size, std::size_t PostPadSize>
bool operator>= (CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs, bool operator>= (IdentifierStorage <PrePadSize, Size, PostPadSize> const& lhs,
CryptoIdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs) IdentifierStorage <PrePadSize, Size, PostPadSize> const& rhs)
{ {
return !(lhs<rhs); return !(lhs<rhs);
} }

View File

@@ -4,8 +4,8 @@
*/ */
//============================================================================== //==============================================================================
#ifndef RIPPLE_TYPES_CRYPTOIDENTIFIERTYPE_H_INCLUDED #ifndef RIPPLE_TYPES_IDENTIFIERTYPE_H_INCLUDED
#define RIPPLE_TYPES_CRYPTOIDENTIFIERTYPE_H_INCLUDED #define RIPPLE_TYPES_IDENTIFIERTYPE_H_INCLUDED
#include <functional> #include <functional>
#include <iterator> #include <iterator>
@@ -19,7 +19,7 @@ namespace ripple {
/** Template for generalizing the cryptographic primitives used. */ /** Template for generalizing the cryptographic primitives used. */
template <class Traits> template <class Traits>
class CryptoIdentifierType : public Traits::base class IdentifierType : public Traits::base
{ {
public: public:
static std::size_t const size = Traits::size; static std::size_t const size = Traits::size;
@@ -36,7 +36,7 @@ public:
template <typename Arg> template <typename Arg>
hasher (Arg arg) : m_hasher (arg) hasher (Arg arg) : m_hasher (arg)
{ } { }
std::size_t operator() (CryptoIdentifierType const& id) const std::size_t operator() (IdentifierType const& id) const
{ return m_hasher(id.value()); } { return m_hasher(id.value()); }
private: private:
typename Traits::hasher m_hasher; typename Traits::hasher m_hasher;
@@ -51,39 +51,39 @@ public:
template <typename Arg> template <typename Arg>
equal (Arg arg) : m_equal (arg) equal (Arg arg) : m_equal (arg)
{ } { }
bool operator() (CryptoIdentifierType const& lhs, bool operator() (IdentifierType const& lhs,
CryptoIdentifierType const& rhs) const IdentifierType const& rhs) const
{ return m_equal (lhs.value(), rhs.value()); } { return m_equal (lhs.value(), rhs.value()); }
private: private:
typename Traits::equal m_equal; typename Traits::equal m_equal;
}; };
/** Create an uninitialized value. */ /** Create an uninitialized value. */
CryptoIdentifierType () IdentifierType ()
{ {
} }
/** Create a copy from another value . */ /** Create a copy from another value . */
CryptoIdentifierType (value_type const& value) IdentifierType (value_type const& value)
: m_value (value) : m_value (value)
{ {
} }
/** Create a copy of the value from range of bytes. */ /** Create a copy of the value from range of bytes. */
CryptoIdentifierType (uint8 const* begin, uint8 const* end) IdentifierType (uint8 const* begin, uint8 const* end)
{ {
Traits::construct (begin, end, m_value); Traits::construct (begin, end, m_value);
} }
/** Conversion construction from any specialized type. */ /** Conversion construction from any specialized type. */
template <typename Other> template <typename Other>
explicit CryptoIdentifierType (Other const& other) explicit IdentifierType (Other const& other)
{ {
this->operator= (other); this->operator= (other);
} }
/** Assign a copy from another value. */ /** Assign a copy from another value. */
CryptoIdentifierType& operator= (value_type const& value) IdentifierType& operator= (value_type const& value)
{ {
m_value = value; m_value = value;
return *this; return *this;
@@ -91,7 +91,7 @@ public:
/** Copy conversion from any specialized type. */ /** Copy conversion from any specialized type. */
template <typename Other> template <typename Other>
CryptoIdentifierType& operator= (Other const& other) IdentifierType& operator= (Other const& other)
{ {
typename Traits::template assign <Other> () ( typename Traits::template assign <Other> () (
m_value, other); m_value, other);
@@ -104,6 +104,25 @@ public:
return m_value; return m_value;
} }
/** Smart dereference.
This provides access to the underlying container for compatibility.
For example, to call member functions that are otherwise not
available.
*/
value_type const* operator->() const
{
return &value();
}
/** Implicit conversion to value_type.
This lets the IdentifierType appear as an rvalue in an assignment
where the lvalue is of type value_type.
*/
operator value_type const& () const
{
return value();
}
/** Iterator access. */ /** Iterator access. */
/** @{ */ /** @{ */
const_iterator begin() const { return value().begin(); } const_iterator begin() const { return value().begin(); }
@@ -128,9 +147,41 @@ private:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
template <class Traits>
bool operator== (IdentifierType<Traits> const& lhs,
IdentifierType<Traits> const& rhs)
{ return lhs.value() == rhs.value(); }
template <class Traits>
bool operator!= (IdentifierType<Traits> const& lhs,
IdentifierType<Traits> const& rhs)
{ return lhs.value() != rhs.value(); }
template <class Traits>
bool operator< (IdentifierType<Traits> const& lhs,
IdentifierType<Traits> const& rhs)
{ return lhs.value() < rhs.value(); }
template <class Traits>
bool operator> (IdentifierType<Traits> const& lhs,
IdentifierType<Traits> const& rhs)
{ return lhs.value() > rhs.value(); }
template <class Traits>
bool operator<= (IdentifierType<Traits> const& lhs,
IdentifierType<Traits> const& rhs)
{ return lhs.value() <= rhs.value(); }
template <class Traits>
bool operator>= (IdentifierType<Traits> const& lhs,
IdentifierType<Traits> const& rhs)
{ return lhs.value() >= rhs.value(); }
//------------------------------------------------------------------------------
template <class Traits> template <class Traits>
std::ostream& operator<< (std::ostream& os, std::ostream& operator<< (std::ostream& os,
CryptoIdentifierType <Traits> const& id) IdentifierType <Traits> const& id)
{ {
os << id.to_string(); os << id.to_string();
return os; return os;
@@ -138,7 +189,7 @@ std::ostream& operator<< (std::ostream& os,
template <class Traits> template <class Traits>
std::istream& operator>> (std::istream& is, std::istream& operator>> (std::istream& is,
CryptoIdentifierType <Traits> const& id) IdentifierType <Traits> const& id)
{ {
return is; return is;
} }
@@ -151,10 +202,10 @@ namespace std {
/** Specialization for hash. */ /** Specialization for hash. */
template <class Traits> template <class Traits>
struct hash <ripple::CryptoIdentifierType <Traits> > struct hash <ripple::IdentifierType <Traits> >
{ {
public: public:
typedef ripple::CryptoIdentifierType <Traits> argument_type; typedef ripple::IdentifierType <Traits> argument_type;
typedef std::size_t result_type; typedef std::size_t result_type;
hash () hash ()
@@ -182,11 +233,11 @@ private:
/** Specialization for equal_to. */ /** Specialization for equal_to. */
template <class Traits> template <class Traits>
struct equal_to <ripple::CryptoIdentifierType <Traits> > struct equal_to <ripple::IdentifierType <Traits> >
{ {
public: public:
typedef bool result_type; typedef bool result_type;
typedef ripple::CryptoIdentifierType <Traits> argument_type; typedef ripple::IdentifierType <Traits> argument_type;
typedef argument_type first_argument_type; typedef argument_type first_argument_type;
typedef argument_type second_argument_type; typedef argument_type second_argument_type;

View File

@@ -7,12 +7,12 @@
#ifndef RIPPLE_TYPES_RIPPLEACCOUNTID_H_INCLUDED #ifndef RIPPLE_TYPES_RIPPLEACCOUNTID_H_INCLUDED
#define RIPPLE_TYPES_RIPPLEACCOUNTID_H_INCLUDED #define RIPPLE_TYPES_RIPPLEACCOUNTID_H_INCLUDED
#include "RippleCryptoIdentifier.h" #include "CryptoIdentifier.h"
namespace ripple { namespace ripple {
class RippleAccountIDTraits class RippleAccountIDTraits
: public RippleCryptoIdentifier <20, 0, true> : public CryptoIdentifier <20, 0, true>
{ {
public: public:
template <typename Other> template <typename Other>
@@ -42,7 +42,7 @@ public:
} }
}; };
typedef CryptoIdentifierType <RippleAccountIDTraits> RippleAccountID; typedef IdentifierType <RippleAccountIDTraits> RippleAccountID;
} }

View File

@@ -7,12 +7,12 @@
#ifndef RIPPLE_TYPES_RIPPLEACCOUNTPRIVATEKEY_H_INCLUDED #ifndef RIPPLE_TYPES_RIPPLEACCOUNTPRIVATEKEY_H_INCLUDED
#define RIPPLE_TYPES_RIPPLEACCOUNTPRIVATEKEY_H_INCLUDED #define RIPPLE_TYPES_RIPPLEACCOUNTPRIVATEKEY_H_INCLUDED
#include "RippleCryptoIdentifier.h" #include "CryptoIdentifier.h"
namespace ripple { namespace ripple {
class RippleAccountPrivateKeyTraits class RippleAccountPrivateKeyTraits
: public RippleCryptoIdentifier <32, 34, true> : public CryptoIdentifier <32, 34, true>
{ {
public: public:
template <typename Other> template <typename Other>
@@ -25,7 +25,7 @@ public:
}; };
}; };
typedef CryptoIdentifierType <RippleAccountPrivateKeyTraits> RippleAccountPrivateKey; typedef IdentifierType <RippleAccountPrivateKeyTraits> RippleAccountPrivateKey;
} }

View File

@@ -7,12 +7,12 @@
#ifndef RIPPLE_TYPES_RIPPLEACCOUNTPUBLICKEY_H_INCLUDED #ifndef RIPPLE_TYPES_RIPPLEACCOUNTPUBLICKEY_H_INCLUDED
#define RIPPLE_TYPES_RIPPLEACCOUNTPUBLICKEY_H_INCLUDED #define RIPPLE_TYPES_RIPPLEACCOUNTPUBLICKEY_H_INCLUDED
#include "RippleCryptoIdentifier.h" #include "CryptoIdentifier.h"
namespace ripple { namespace ripple {
class RippleAccountPublicKeyTraits class RippleAccountPublicKeyTraits
: public RippleCryptoIdentifier <33, 35, true> : public CryptoIdentifier <33, 35, true>
{ {
public: public:
template <typename Other> template <typename Other>
@@ -25,7 +25,7 @@ public:
}; };
}; };
typedef CryptoIdentifierType <RippleAccountPublicKeyTraits> RippleAccountPublicKey; typedef IdentifierType <RippleAccountPublicKeyTraits> RippleAccountPublicKey;
} }

View File

@@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
*/
//==============================================================================
#ifndef RIPPLE_TYPES_RIPPLELEDGERHASH_H_INCLUDED
#define RIPPLE_TYPES_RIPPLELEDGERHASH_H_INCLUDED
namespace ripple {
/*
Hashes are used to uniquely identify objects like
transactions, peers, validators, and accounts.
For historical reasons, some hashes are 256 bits and some are 160.
David:
"The theory is that you may need to communicate public keys
to others, so having them be shorter is a good idea. plus,
you can't arbitrarily tweak them because you wouldn't know
the corresponding private key anyway. So the security
requirements aren't as great."
*/
/** The SHA256 bit hash of a signed ledger. */
class RippleLedgerHashTraits : public SimpleIdentifier <32>
{
public:
};
/** A ledger hash. */
typedef IdentifierType <RippleLedgerHashTraits> RippleLedgerHash;
// Legacy
typedef uint256 LedgerHash;
}
#endif

View File

@@ -7,12 +7,12 @@
#ifndef RIPPLE_TYPES_RIPPLEPRIVATEKEY_H_INCLUDED #ifndef RIPPLE_TYPES_RIPPLEPRIVATEKEY_H_INCLUDED
#define RIPPLE_TYPES_RIPPLEPRIVATEKEY_H_INCLUDED #define RIPPLE_TYPES_RIPPLEPRIVATEKEY_H_INCLUDED
#include "RippleCryptoIdentifier.h" #include "CryptoIdentifier.h"
namespace ripple { namespace ripple {
class RipplePrivateKeyTraits class RipplePrivateKeyTraits
: public RippleCryptoIdentifier <32, 32, true> : public CryptoIdentifier <32, 32, true>
{ {
public: public:
template <typename Other> template <typename Other>
@@ -25,7 +25,7 @@ public:
}; };
}; };
typedef CryptoIdentifierType <RipplePrivateKeyTraits> RipplePrivateKey; typedef IdentifierType <RipplePrivateKeyTraits> RipplePrivateKey;
} }

View File

@@ -7,12 +7,10 @@
#ifndef RIPPLE_TYPES_RIPPLEPUBLICKEY_H_INCLUDED #ifndef RIPPLE_TYPES_RIPPLEPUBLICKEY_H_INCLUDED
#define RIPPLE_TYPES_RIPPLEPUBLICKEY_H_INCLUDED #define RIPPLE_TYPES_RIPPLEPUBLICKEY_H_INCLUDED
#include "RippleCryptoIdentifier.h"
namespace ripple { namespace ripple {
class RipplePublicKeyTraits class RipplePublicKeyTraits
: public RippleCryptoIdentifier <33, 28, true> : public CryptoIdentifier <33, 28, true>
{ {
public: public:
template <typename Other> template <typename Other>
@@ -25,7 +23,7 @@ public:
}; };
}; };
typedef CryptoIdentifierType <RipplePublicKeyTraits> RipplePublicKey; typedef IdentifierType <RipplePublicKeyTraits> RipplePublicKey;
} }

View File

@@ -9,8 +9,22 @@
namespace ripple { namespace ripple {
/** A container holding the hash of a public key in binary format. */ /** Traits for the public key hash. */
typedef UnsignedInteger <20> RipplePublicKeyHash; class RipplePublicKeyHashTraits : public SimpleIdentifier <20>
{
public:
template <typename Other>
struct assign
{
void operator() (value_type& value, Other const& other)
{
value = other;
}
};
};
/** A container holding the 160-bit hash of the 257-bit public key. */
typedef IdentifierType <RipplePublicKeyHashTraits> RipplePublicKeyHash;
} }

View File

@@ -0,0 +1,58 @@
//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
*/
//==============================================================================
#ifndef RIPPLE_TYPES_SIMPLEIDENTIFIER_H_INCLUDED
#define RIPPLE_TYPES_SIMPLEIDENTIFIER_H_INCLUDED
namespace ripple {
/** Provides common traits for non-signing identifiers like ledger hashes.
The storage is a suitably sized instance of base_uint.
*/
template <std::size_t Bytes>
class SimpleIdentifier
{
public:
static std::size_t const size = Bytes;
typedef std::size_t size_type;
typedef base_uint <Bytes*8> value_type;
typedef typename value_type::hasher hasher;
typedef typename value_type::equal equal;
/** Initialize from an input sequence. */
static void construct (
uint8 const* begin, uint8 const* end,
value_type& value)
{
std::copy (begin, end, value.begin());
}
/** Base class for IdentifierType. */
struct base { };
/** Convert to std::string. */
static std::string to_string (value_type const& value)
{
return strHex (value.cbegin(), size);
}
/** Assignment specializations.
When Other is the same as value_type, this is a copy assignment.
*/
template <typename Other>
struct assign
{
void operator() (value_type& value, Other const& other)
{
value = other;
}
};
};
}
#endif

View File

@@ -38,9 +38,83 @@ protected:
unsigned int pn[WIDTH]; unsigned int pn[WIDTH];
public: public:
base_uint () /** Construct uninitialized.
Requirements:
std::is_trivially_constructible<base_uint>::value == true
*/
base_uint () { }
//--------------------------------------------------------------------------
//
// STL Container Interface
//
static std::size_t const bytes = (BITS/8);
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef unsigned char value_type;
typedef value_type* pointer;
typedef value_type& reference;
typedef value_type const* const_pointer;
typedef value_type const& const_reference;
typedef pointer iterator;
typedef const_pointer const_iterator;
typedef std::reverse_iterator
<iterator> reverse_iterator;
typedef std::reverse_iterator
<const_iterator> const_reverse_iterator;
pointer data() { return reinterpret_cast<pointer>(pn); }
const_pointer data() const { return reinterpret_cast<const_pointer>(pn); }
iterator begin() { return data(); }
iterator end() { return data()+bytes; }
const_iterator begin() const { return data(); }
const_iterator end() const { return data()+bytes; }
const_iterator cbegin() const { return data(); }
const_iterator cend() const { return data()+bytes; }
reverse_iterator rbegin() { return end(); }
reverse_iterator rend() { return begin(); }
const_reverse_iterator rbegin() const { return end(); }
const_reverse_iterator rend() const { return begin(); }
const_reverse_iterator crbegin() const { return cend(); }
const_reverse_iterator crend() const { return cbegin(); }
/** Value hashing function.
The seed prevents crafted inputs from causing degenarate parent containers.
*/
class hasher
{ {
} public:
explicit hasher (HashValue seedToUse = Random::getSystemRandom ().nextInt ())
: m_seed (seedToUse)
{
}
std::size_t operator() (base_uint const& value) const
{
std::size_t hash;
Murmur::Hash (value.cbegin (), (BITS / 8), m_seed, &hash);
return hash;
}
private:
std::size_t m_seed;
};
/** Container equality testing function. */
class equal
{
public:
bool operator() (base_uint const& lhs, base_uint const& rhs) const
{
return lhs == rhs;
}
};
//--------------------------------------------------------------------------
protected: protected:
// This is to disambiguate from other 1 parameter ctors // This is to disambiguate from other 1 parameter ctors
@@ -58,7 +132,6 @@ protected:
memcpy (&pn [0], data, BITS / 8); memcpy (&pn [0], data, BITS / 8);
} }
public: public:
bool isZero () const bool isZero () const
{ {
for (int i = 0; i < WIDTH; i++) for (int i = 0; i < WIDTH; i++)
@@ -364,36 +437,6 @@ public:
return GetHex (); return GetHex ();
} }
unsigned char* begin ()
{
return reinterpret_cast<unsigned char*> (pn);
}
unsigned char* end ()
{
return reinterpret_cast<unsigned char*> (pn + WIDTH);
}
unsigned char const* cbegin () const noexcept
{
return reinterpret_cast <unsigned char const*> (pn);
}
unsigned char const* cend () const noexcept
{
return reinterpret_cast<unsigned char const*> (pn + WIDTH);
}
const unsigned char* begin () const noexcept
{
return cbegin ();
}
const unsigned char* end () const noexcept
{
return cend ();
}
unsigned int size () const unsigned int size () const
{ {
return sizeof (pn); return sizeof (pn);
@@ -439,4 +482,70 @@ std::ostream& operator<< (std::ostream& out, const base_uint<BITS>& u)
} }
//------------------------------------------------------------------------------
namespace std {
/** Specialization for hash. */
template<unsigned int BITS>
struct hash <ripple::base_uint <BITS> >
{
public:
typedef ripple::base_uint <BITS> argument_type;
typedef std::size_t result_type;
hash ()
{
static typename argument_type::hasher s_hash;
m_hash = s_hash;
}
template <typename Arg>
explicit hash (Arg arg) : m_hash (arg)
{
}
result_type operator() (argument_type const& key) const
{
return m_hash (key);
}
private:
typename argument_type::hasher m_hash;
};
//------------------------------------------------------------------------------
/** Specialization for equal_to. */
template <unsigned int BITS>
struct equal_to <ripple::base_uint <BITS> >
{
public:
typedef bool result_type;
typedef ripple::base_uint<BITS> argument_type;
typedef argument_type first_argument_type;
typedef argument_type second_argument_type;
equal_to ()
{
}
template <typename Arg>
explicit equal_to (Arg arg)
: m_equal (arg)
{
}
result_type operator() (argument_type const& lhs,
argument_type const& rhs) const
{
return m_equal (lhs, rhs);
}
private:
typename argument_type::equal m_equal;
};
}
#endif #endif

View File

@@ -24,4 +24,4 @@
#include "impl/UInt128.cpp" #include "impl/UInt128.cpp"
#include "impl/UInt160.cpp" #include "impl/UInt160.cpp"
#include "impl/UInt256.cpp" #include "impl/UInt256.cpp"
#include "impl/RippleCryptoIdentifierTests.cpp" #include "impl/RippleIdentifierTests.cpp"

View File

@@ -37,15 +37,17 @@ using namespace beast;
# include "api/UInt256.h" # include "api/UInt256.h"
# include "api/RandomNumbers.h" # include "api/RandomNumbers.h"
#include "api/HashMaps.h" #include "api/HashMaps.h"
#include "api/CryptoIdentifierType.h"
# include "api/CryptoIdentifierStorage.h"
# include "api/IdentifierType.h"
# include "api/IdentifierStorage.h"
# include "api/CryptoIdentifier.h"
#include "api/RippleAccountID.h" #include "api/RippleAccountID.h"
#include "api/RippleAccountPublicKey.h" #include "api/RippleAccountPublicKey.h"
#include "api/RippleAccountPrivateKey.h" #include "api/RippleAccountPrivateKey.h"
#include "api/RipplePublicKey.h" #include "api/RipplePublicKey.h"
#include "api/RipplePrivateKey.h" #include "api/RipplePrivateKey.h"
# include "api/SimpleIdentifier.h"
#include "api/RippleLedgerHash.h"
#include "api/RipplePublicKeyHash.h" #include "api/RipplePublicKeyHash.h"
#endif #endif

View File

@@ -70,7 +70,7 @@ public:
// Trusted Validators // Trusted Validators
//virtual bool isPublicKeyTrusted (PublicKey const& publicKey) = 0; //virtual bool isPublicKeyTrusted (RipplePublicKey const& publicKey) = 0;
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------

View File

@@ -18,7 +18,7 @@ public:
struct Info struct Info
{ {
/** The unique key for this validator. */ /** The unique key for this validator. */
PublicKey publicKey; RipplePublicKey publicKey;
/** Optional human readable comment describing the validator. */ /** Optional human readable comment describing the validator. */
String label; String label;

View File

@@ -10,13 +10,11 @@
namespace ripple { namespace ripple {
namespace Validators { namespace Validators {
typedef RipplePublicKey PublicKey;
typedef RipplePublicKeyHash PublicKeyHash;
struct ReceivedValidation struct ReceivedValidation
{ {
uint256 ledgerHash; RippleLedgerHash ledgerHash;
PublicKeyHash signerPublicKeyHash; RipplePublicKey publicKey;
RipplePublicKeyHash publicKeyHash;
}; };
/** Callback used to optionally cancel long running fetch operations. */ /** Callback used to optionally cancel long running fetch operations. */

View File

@@ -22,7 +22,7 @@ public:
} }
}; };
typedef boost::unordered_map <PublicKey, Info, PublicKey::hasher> MapType; typedef boost::unordered_map <RipplePublicKey, Info, RipplePublicKey::hasher> MapType;
ChosenList (std::size_t expectedSize = 0) ChosenList (std::size_t expectedSize = 0)
{ {
@@ -40,17 +40,17 @@ public:
return m_map.size (); return m_map.size ();
} }
void insert (PublicKey const& key, Info const& info) noexcept void insert (RipplePublicKey const& key, Info const& info) noexcept
{ {
m_map [key] = info; m_map [key] = info;
} }
bool containsPublicKey (PublicKey const& publicKey) const noexcept bool containsPublicKey (RipplePublicKey const& publicKey) const noexcept
{ {
return m_map.find (publicKey) != m_map.cend (); return m_map.find (publicKey) != m_map.cend ();
} }
bool containsPublicKeyHash (PublicKeyHash const& publicKeyHash) const noexcept bool containsPublicKeyHash (RipplePublicKeyHash const& publicKeyHash) const noexcept
{ {
return false; return false;
} }

View File

@@ -46,7 +46,7 @@ public:
}; };
typedef boost::unordered_map < typedef boost::unordered_map <
PublicKey, ValidatorInfo, PublicKey::hasher> MapType; RipplePublicKey, ValidatorInfo, RipplePublicKey::hasher> MapType;
struct State struct State
{ {
@@ -388,7 +388,7 @@ public:
// Returns `true` if the public key hash is contained in the Chosen List. // Returns `true` if the public key hash is contained in the Chosen List.
// //
bool isTrustedPublicKeyHash (PublicKeyHash const& publicKeyHash) bool isTrustedPublicKeyHash (RipplePublicKeyHash const& publicKeyHash)
{ {
return m_chosenList->containsPublicKeyHash (publicKeyHash); return m_chosenList->containsPublicKeyHash (publicKeyHash);
} }

View File

@@ -119,7 +119,7 @@ public:
for (uint32 i = m_start ; i < m_end; ++i) for (uint32 i = m_start ; i < m_end; ++i)
{ {
Info info; Info info;
info.publicKey = Validators::PublicKey::createFromInteger (i); info.publicKey = RipplePublicKey::createFromInteger (i);
info.label = String::fromNumber (i); info.label = String::fromNumber (i);
result.list.add (info); result.list.add (info);
} }

View File

@@ -236,17 +236,17 @@ Time Utilities::stringToTime (String s)
return Time (0); return Time (0);
} }
std::string Utilities::publicKeyToString (PublicKey const& publicKey) std::string Utilities::publicKeyToString (RipplePublicKey const& publicKey)
{ {
std::string s (PublicKey::size, ' '); std::string s (RipplePublicKey::size, ' ');
std::copy (publicKey.cbegin(), publicKey.cend(), s.begin()); std::copy (publicKey.cbegin(), publicKey.cend(), s.begin());
return s; return s;
} }
PublicKey Utilities::stringToPublicKey (std::string const& s) RipplePublicKey Utilities::stringToPublicKey (std::string const& s)
{ {
bassert (s.size() == PublicKey::size); bassert (s.size() == RipplePublicKey::size);
return PublicKey (); return RipplePublicKey ();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@@ -54,9 +54,9 @@ public:
static String timeToString (Time const& t); static String timeToString (Time const& t);
static Time stringToTime (String s); static Time stringToTime (String s);
// conversion between PublicKey and String // conversion between RipplePublicKey and String
static std::string publicKeyToString (PublicKey const& publicKey); static std::string publicKeyToString (RipplePublicKey const& publicKey);
static PublicKey stringToPublicKey (std::string const& s); static RipplePublicKey stringToPublicKey (std::string const& s);
struct Helpers; struct Helpers;

View File

@@ -76,7 +76,7 @@ InboundLedger::pointer InboundLedgers::find (uint256 const& hash)
return ret; return ret;
} }
bool InboundLedgers::hasLedger (uint256 const& hash) bool InboundLedgers::hasLedger (LedgerHash const& hash)
{ {
assert (hash.isNonZero ()); assert (hash.isNonZero ());
@@ -84,7 +84,7 @@ bool InboundLedgers::hasLedger (uint256 const& hash)
return mLedgers.find (hash) != mLedgers.end (); return mLedgers.find (hash) != mLedgers.end ();
} }
void InboundLedgers::dropLedger (uint256 const& hash) void InboundLedgers::dropLedger (LedgerHash const& hash)
{ {
assert (hash.isNonZero ()); assert (hash.isNonZero ());
@@ -93,7 +93,7 @@ void InboundLedgers::dropLedger (uint256 const& hash)
} }
bool InboundLedgers::awaitLedgerData (uint256 const& ledgerHash) bool InboundLedgers::awaitLedgerData (LedgerHash const& ledgerHash)
{ {
InboundLedger::pointer ledger = find (ledgerHash); InboundLedger::pointer ledger = find (ledgerHash);
@@ -114,7 +114,7 @@ inboundLedgerTrigger:
*/ */
// means "We got some data from an inbound ledger" // means "We got some data from an inbound ledger"
void InboundLedgers::gotLedgerData (Job&, uint256 hash, void InboundLedgers::gotLedgerData (Job&, LedgerHash hash,
boost::shared_ptr<protocol::TMLedgerData> packet_ptr, boost::weak_ptr<Peer> wPeer) boost::shared_ptr<protocol::TMLedgerData> packet_ptr, boost::weak_ptr<Peer> wPeer)
{ {
protocol::TMLedgerData& packet = *packet_ptr; protocol::TMLedgerData& packet = *packet_ptr;

View File

@@ -1450,8 +1450,8 @@ static void checkValidation (Job&, SerializedValidation::pointer val, bool isTru
SerializedValidation const& sv (*val); SerializedValidation const& sv (*val);
Validators::ReceivedValidation rv; Validators::ReceivedValidation rv;
rv.ledgerHash = sv.getLedgerHash (); rv.ledgerHash = sv.getLedgerHash ();
uint160 const publicKeyHash (sv.getSignerPublic ().getNodeID ()); rv.publicKey = sv.getSignerPublic();
rv.signerPublicKeyHash = RipplePublicKeyHash (publicKeyHash.begin ()); rv.publicKeyHash = sv.getSignerPublic();
getApp ().getValidators ().receiveValidation (rv); getApp ().getValidators ().receiveValidation (rv);
#endif #endif
} }

View File

@@ -28,24 +28,6 @@ struct Protocol
static int const txMaxSizeBytes = 1024 * 1024; // 1048576 static int const txMaxSizeBytes = 1024 * 1024; // 1048576
}; };
/*
Hashes are used to uniquely identify objects like
transactions, peers, validators, and accounts.
For historical reasons, some hashes are 256 bits and some are 160.
David:
"The theory is that you may need to communicate public keys
to others, so having them be shorter is a good idea. plus,
you can't arbitrarily tweak them because you wouldn't know
the corresponding private key anyway. So the security
requirements aren't as great."
*/
/** A ledger hash.
*/
typedef uint256 LedgerHash;
/** A ledger index. /** A ledger index.
*/ */
// VFALCO TODO pick one. I like Index since its not an abbreviation // VFALCO TODO pick one. I like Index since its not an abbreviation

View File

@@ -951,7 +951,7 @@ static RippleAddressTests rippleAddressTests;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
class RippleCryptoIdentifierTests : public UnitTest class RippleIdentifierTests : public UnitTest
{ {
public: public:
void runTest () void runTest ()
@@ -1013,9 +1013,9 @@ public:
privateKey.to_string()); privateKey.to_string());
} }
RippleCryptoIdentifierTests () : UnitTest ("RippleCryptoIdentifier", "ripple") RippleIdentifierTests () : UnitTest ("RippleIdentifier", "ripple")
{ {
} }
}; };
static RippleCryptoIdentifierTests rippleCryptoIdentifierTests; static RippleIdentifierTests rippleIdentifierTests;

View File

@@ -206,6 +206,7 @@ public:
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** RipplePublicKey */
template <> template <>
struct RipplePublicKeyTraits::assign <RippleAddress> struct RipplePublicKeyTraits::assign <RippleAddress>
{ {
@@ -216,6 +217,18 @@ struct RipplePublicKeyTraits::assign <RippleAddress>
} }
}; };
/** RipplePublicKeyHash */
template <>
struct RipplePublicKeyHashTraits::assign <RippleAddress>
{
void operator() (value_type& value, RippleAddress const& v) const
{
uint160 const ui (v.getNodeID ());
construct (ui.begin(), ui.end(), value);
}
};
/** RipplePrivateKey */
template <> template <>
struct RipplePrivateKeyTraits::assign <RippleAddress> struct RipplePrivateKeyTraits::assign <RippleAddress>
{ {
@@ -226,6 +239,7 @@ struct RipplePrivateKeyTraits::assign <RippleAddress>
} }
}; };
/** RippleAccountID */
template <> template <>
struct RippleAccountIDTraits::assign <RippleAddress> struct RippleAccountIDTraits::assign <RippleAddress>
{ {
@@ -236,6 +250,7 @@ struct RippleAccountIDTraits::assign <RippleAddress>
} }
}; };
/** RippleAccountPublicKey */
template <> template <>
struct RippleAccountPublicKeyTraits::assign <RippleAddress> struct RippleAccountPublicKeyTraits::assign <RippleAddress>
{ {
@@ -246,6 +261,7 @@ struct RippleAccountPublicKeyTraits::assign <RippleAddress>
} }
}; };
/** RippleAccountPrivateKey */
template <> template <>
struct RippleAccountPrivateKeyTraits::assign <RippleAddress> struct RippleAccountPrivateKeyTraits::assign <RippleAddress>
{ {