diff --git a/Builds/VisualStudio2013/RippleD.vcxproj b/Builds/VisualStudio2013/RippleD.vcxproj
index 37fda299c..ac2f4b93f 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj
+++ b/Builds/VisualStudio2013/RippleD.vcxproj
@@ -279,9 +279,6 @@
True
-
- True
-
True
@@ -290,8 +287,6 @@
-
-
diff --git a/Builds/VisualStudio2013/RippleD.vcxproj.filters b/Builds/VisualStudio2013/RippleD.vcxproj.filters
index 7175faadb..85af6ab46 100644
--- a/Builds/VisualStudio2013/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2013/RippleD.vcxproj.filters
@@ -780,9 +780,6 @@
beast\crypto
-
- beast\crypto\impl
-
beast\crypto\impl
@@ -792,9 +789,6 @@
beast\crypto\impl\sha2
-
- beast\crypto
-
beast\crypto
diff --git a/src/ripple/app/misc/NetworkOPs.cpp b/src/ripple/app/misc/NetworkOPs.cpp
index fde92f5e9..b2192f32a 100644
--- a/src/ripple/app/misc/NetworkOPs.cpp
+++ b/src/ripple/app/misc/NetworkOPs.cpp
@@ -506,6 +506,8 @@ private:
void pubServer ();
+ std::string getHostId (bool forAdmin);
+
private:
clock_type& m_clock;
@@ -581,6 +583,19 @@ private:
};
//------------------------------------------------------------------------------
+std::string
+NetworkOPsImp::getHostId (bool forAdmin)
+{
+ if (forAdmin)
+ return beast::SystemStats::getComputerName ();
+
+ // For non-admin uses we hash the node ID into a single RFC1751 word:
+ // (this could be cached instead of recalculated every time)
+ Blob const& addr (getApp ().getLocalCredentials ().getNodePublic ().
+ getNodePublic ());
+
+ return RFC1751::getWordFromBlob (addr.data (), addr.size ());
+}
void NetworkOPsImp::setStateTimer ()
{
@@ -2344,22 +2359,7 @@ Json::Value NetworkOPsImp::getServerInfo (bool human, bool admin)
// hostid: unique string describing the machine
if (human)
- {
- if (! admin)
- {
- // For a non admin connection, hash the node ID into a single
- // RFC1751 word.
- Blob const& addr (getApp().getLocalCredentials ().getNodePublic ().
- getNodePublic ());
- info [jss::hostid] = RFC1751::getWordFromBlob (
- addr.data (), addr.size ());
- }
- else
- {
- // Only admins get the hostname for security reasons
- info [jss::hostid] = beast::SystemStats::getComputerName();
- }
- }
+ info [jss::hostid] = getHostId (admin);
info [jss::build_version] = BuildInfo::getVersionString ();
@@ -2999,23 +2999,10 @@ bool NetworkOPsImp::subServer (InfoSub::ref isrListener, Json::Value& jvResult,
jvResult[jss::server_status] = strOperatingMode ();
jvResult[jss::load_base] = getApp().getFeeTrack ().getLoadBase ();
jvResult[jss::load_factor] = getApp().getFeeTrack ().getLoadFactor ();
+ jvResult [jss::hostid] = getHostId (admin);
jvResult[jss::pubkey_node] = getApp ().getLocalCredentials ().
getNodePublic ().humanNodePublic ();
- if (! admin)
- {
- // For a non admin connection, hash the node ID into a single RFC1751 word
- Blob const& addr (getApp ().getLocalCredentials ().getNodePublic ().
- getNodePublic ());
- jvResult[jss::hostid] = RFC1751::getWordFromBlob (addr.data (),
- addr.size ());
- }
- else
- {
- // Only admins get the hostname for security reasons
- jvResult[jss::hostid] = beast::SystemStats::getComputerName ();
- }
-
ScopedLockType sl (mLock);
return mSubServer.emplace (isrListener->getSeq (), isrListener).second;
}
diff --git a/src/ripple/crypto/RFC1751.h b/src/ripple/crypto/RFC1751.h
index 3f085adad..3a7ea4b85 100644
--- a/src/ripple/crypto/RFC1751.h
+++ b/src/ripple/crypto/RFC1751.h
@@ -39,7 +39,7 @@ public:
it to turn the pubkey_node into an easily remembered and identified
4 character string.
*/
- static std::string getWordFromBlob (void const* data, size_t bytes);
+ static std::string getWordFromBlob (void const* blob, size_t bytes);
private:
static unsigned long extract (char const* s, int start, int length);
diff --git a/src/ripple/crypto/impl/RFC1751.cpp b/src/ripple/crypto/impl/RFC1751.cpp
index 06a734e35..8b7275ba0 100644
--- a/src/ripple/crypto/impl/RFC1751.cpp
+++ b/src/ripple/crypto/impl/RFC1751.cpp
@@ -18,7 +18,6 @@
//==============================================================================
#include
-#include
#include
#include
#include
@@ -482,14 +481,25 @@ void RFC1751::getEnglishFromKey (std::string& strHuman, std::string const& strKe
strHuman = strFirst + " " + strSecond;
}
-std::string RFC1751::getWordFromBlob (void const* data, size_t bytes)
+std::string
+RFC1751::getWordFromBlob (void const* blob, size_t bytes)
{
- std::uint32_t hash;
+ // This is a simple implementation of the Jenkins one-at-a-time hash
+ // algorithm:
+ // http://en.wikipedia.org/wiki/Jenkins_hash_function#one-at-a-time
+ unsigned char const* data = static_cast(blob);
+ std::uint32_t hash = 0;
- // VFALCO Murmur is deprecated and since this does not need to be
- // cryptographically secure we should just replace it with something
- // else and remove Murmur from beast.
- beast::Murmur::Hash (data, bytes, 0, &hash);
+ for (size_t i = 0; i < bytes; ++i)
+ {
+ hash += data[i];
+ hash += (hash << 10);
+ hash ^= (hash >> 6);
+ }
+
+ hash += (hash << 3);
+ hash ^= (hash >> 11);
+ hash += (hash << 15);
return s_dictionary [hash % (sizeof (s_dictionary) / sizeof (s_dictionary [0]))];
}
diff --git a/src/ripple/types/IdentifierStorage.h b/src/ripple/types/IdentifierStorage.h
index 1d1f83e09..7bccec0f9 100644
--- a/src/ripple/types/IdentifierStorage.h
+++ b/src/ripple/types/IdentifierStorage.h
@@ -20,7 +20,6 @@
#ifndef RIPPLE_TYPES_IDENTIFIERSTORAGE_H_INCLUDED
#define RIPPLE_TYPES_IDENTIFIERSTORAGE_H_INCLUDED
-#include
#include
#include
#include