diff --git a/Builds/VisualStudio2012/RippleD.vcxproj.filters b/Builds/VisualStudio2012/RippleD.vcxproj.filters
index 4ad91a2615..a6d761d4f1 100644
--- a/Builds/VisualStudio2012/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2012/RippleD.vcxproj.filters
@@ -250,6 +250,9 @@
{d7d4123e-3fb2-4f85-9596-1ae26b6c14fd}
+
+ {548e1020-e083-4e5f-b867-59f76ac02d5a}
+
@@ -2295,15 +2298,9 @@
[1] Ripple\resource\api
-
- [1] Ripple\algorithm
-
[1] Ripple\resource\impl
-
- [1] Ripple\algorithm
-
[1] Ripple\peerfinder\impl
@@ -2316,6 +2313,12 @@
[1] Ripple\peerfinder\impl
+
+ [1] Ripple\algorithm\api
+
+
+ [1] Ripple\algorithm\api
+
diff --git a/src/beast/Builds/VisualStudio2012/beast.vcxproj b/src/beast/Builds/VisualStudio2012/beast.vcxproj
index cdf07854e8..9319d642ac 100644
--- a/src/beast/Builds/VisualStudio2012/beast.vcxproj
+++ b/src/beast/Builds/VisualStudio2012/beast.vcxproj
@@ -111,6 +111,7 @@
+
@@ -280,7 +281,6 @@
-
@@ -425,6 +425,12 @@
true
+
+ true
+ true
+ true
+ true
+
true
true
@@ -879,12 +885,6 @@
true
true
-
- true
- true
- true
- true
-
true
true
diff --git a/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters b/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
index 21a8498eb7..dffaf6ebb9 100644
--- a/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
+++ b/src/beast/Builds/VisualStudio2012/beast.vcxproj.filters
@@ -683,9 +683,6 @@
beast_sqdb\detail
-
- beast_core\maths
-
beast_core\text
@@ -1263,6 +1260,9 @@
beast\asio
+
+ beast\crypto
+
@@ -1565,9 +1565,6 @@
beast_sqdb\source
-
- beast_core\maths
-
beast_core\text
@@ -1817,6 +1814,9 @@
beast\asio\impl
+
+ beast\crypto\impl
+
diff --git a/src/beast/beast/Crypto.h b/src/beast/beast/Crypto.h
index 50d8204661..379e172e3b 100644
--- a/src/beast/beast/Crypto.h
+++ b/src/beast/beast/Crypto.h
@@ -20,6 +20,7 @@
#ifndef BEAST_CRYPTO_H_INCLUDED
#define BEAST_CRYPTO_H_INCLUDED
+#include "crypto/MurmurHash.h"
#include "crypto/Sha256.h"
#endif
diff --git a/src/beast/beast/crypto/Crypto.cpp b/src/beast/beast/crypto/Crypto.cpp
index e2b5228a7e..77a73390f9 100644
--- a/src/beast/beast/crypto/Crypto.cpp
+++ b/src/beast/beast/crypto/Crypto.cpp
@@ -19,4 +19,5 @@
#include "BeastConfig.h"
+#include "impl/MurmurHash.cpp"
#include "impl/Sha256.cpp"
diff --git a/src/beast/modules/beast_core/maths/MurmurHash.h b/src/beast/beast/crypto/MurmurHash.h
similarity index 93%
rename from src/beast/modules/beast_core/maths/MurmurHash.h
rename to src/beast/beast/crypto/MurmurHash.h
index 7cdf570f7b..724d62d2fe 100644
--- a/src/beast/modules/beast_core/maths/MurmurHash.h
+++ b/src/beast/beast/crypto/MurmurHash.h
@@ -17,15 +17,15 @@
*/
//==============================================================================
-#ifndef BEAST_MURMURHASH_H_INCLUDED
-#define BEAST_MURMURHASH_H_INCLUDED
+#ifndef BEAST_CRYPTO_MURMURHASH_H_INCLUDED
+#define BEAST_CRYPTO_MURMURHASH_H_INCLUDED
+
+#include "../CStdInt.h"
// Original source code links in .cpp file
-// This file depends on some Beast declarations and defines
-
-namespace Murmur
-{
+namespace beast {
+namespace Murmur {
extern void MurmurHash3_x86_32 (const void* key, int len, uint32 seed, void* out);
extern void MurmurHash3_x86_128 (const void* key, int len, uint32 seed, void* out);
@@ -77,6 +77,7 @@ inline void Hash (const void* key, int len, uint32 seed, HashType* out)
};
}
+}
}
#endif
diff --git a/src/beast/modules/beast_core/maths/MurmurHash.cpp b/src/beast/beast/crypto/impl/MurmurHash.cpp
similarity index 99%
rename from src/beast/modules/beast_core/maths/MurmurHash.cpp
rename to src/beast/beast/crypto/impl/MurmurHash.cpp
index 8f7d7be2d1..1674c3b436 100644
--- a/src/beast/modules/beast_core/maths/MurmurHash.cpp
+++ b/src/beast/beast/crypto/impl/MurmurHash.cpp
@@ -19,8 +19,12 @@
// http://code.google.com/p/smhasher/
-namespace Murmur
-{
+#include "../MurmurHash.h"
+
+#include
+
+namespace beast {
+namespace Murmur {
//-----------------------------------------------------------------------------
// Platform-specific functions and macros
@@ -485,3 +489,4 @@ void MurmurHash3_x64_128 ( const void* key, const int len,
}
}
+}
diff --git a/src/beast/beast/strings/String.h b/src/beast/beast/strings/String.h
index 03d26ca77c..198408ac55 100644
--- a/src/beast/beast/strings/String.h
+++ b/src/beast/beast/strings/String.h
@@ -195,6 +195,9 @@ public:
/** Generates a probably-unique 64-bit hashcode from this string. */
int64 hashCode64() const noexcept;
+ /** Returns a hash value suitable for use with std::hash. */
+ std::size_t hash() const noexcept;
+
/** Returns the number of characters in the string. */
int length() const noexcept;
diff --git a/src/beast/beast/strings/impl/String.cpp b/src/beast/beast/strings/impl/String.cpp
index 5f281dcaa9..b12f397a9d 100644
--- a/src/beast/beast/strings/impl/String.cpp
+++ b/src/beast/beast/strings/impl/String.cpp
@@ -404,26 +404,42 @@ beast_wchar String::operator[] (int index) const noexcept
return text [index];
}
+//------------------------------------------------------------------------------
+
+namespace detail {
+
+template
+struct HashGenerator
+{
+ template
+ static Type calculate (CharPointer t) noexcept
+ {
+ Type result = Type();
+
+ while (! t.isEmpty())
+ result = multiplier * result + t.getAndAdvance();
+
+ return result;
+ }
+
+ enum { multiplier = sizeof (Type) > 4 ? 101 : 31 };
+};
+
+}
+
int String::hashCode() const noexcept
{
- CharPointerType t (text);
- int result = 0;
-
- while (! t.isEmpty())
- result = 31 * result + (int) t.getAndAdvance();
-
- return result;
+ return detail::HashGenerator ::calculate (text);
}
int64 String::hashCode64() const noexcept
{
- CharPointerType t (text);
- int64 result = 0;
+ return detail::HashGenerator ::calculate (text);
+}
- while (! t.isEmpty())
- result = 101 * result + t.getAndAdvance();
-
- return result;
+std::size_t String::hash() const noexcept
+{
+ return detail::HashGenerator::calculate (text);
}
//==============================================================================
diff --git a/src/beast/modules/beast_core/beast_core.cpp b/src/beast/modules/beast_core/beast_core.cpp
index 92abf6fb42..1b6761e3d6 100644
--- a/src/beast/modules/beast_core/beast_core.cpp
+++ b/src/beast/modules/beast_core/beast_core.cpp
@@ -156,7 +156,6 @@ namespace beast
#include "maths/BigInteger.cpp"
#include "maths/Expression.cpp"
-#include "maths/MurmurHash.cpp"
#include "maths/Random.cpp"
#include "memory/MemoryBlock.cpp"
diff --git a/src/beast/modules/beast_core/beast_core.h b/src/beast/modules/beast_core/beast_core.h
index e095d1d27c..74aeb1601a 100644
--- a/src/beast/modules/beast_core/beast_core.h
+++ b/src/beast/modules/beast_core/beast_core.h
@@ -187,7 +187,6 @@ class FileOutputStream;
#include "logging/Logger.h"
#include "maths/Expression.h"
#include "maths/Interval.h"
-#include "maths/MurmurHash.h"
#include "memory/OptionalScopedPointer.h"
#include "memory/SharedSingleton.h"
#include "memory/WeakReference.h"
diff --git a/src/beast/modules/beast_crypto/beast_crypto.h b/src/beast/modules/beast_crypto/beast_crypto.h
index 4e9039bbcc..04404475d6 100644
--- a/src/beast/modules/beast_crypto/beast_crypto.h
+++ b/src/beast/modules/beast_crypto/beast_crypto.h
@@ -38,11 +38,11 @@
#endif
#include "../beast_core/beast_core.h"
+#include "../../beast/crypto/MurmurHash.h"
//------------------------------------------------------------------------------
-namespace beast
-{
+namespace beast {
# include "math/UnsignedIntegerCalc.h"
#include "math/UnsignedInteger.h"
diff --git a/src/ripple/types/api/IdentifierStorage.h b/src/ripple/types/api/IdentifierStorage.h
index 3859eac8c4..b25b776bbf 100644
--- a/src/ripple/types/api/IdentifierStorage.h
+++ b/src/ripple/types/api/IdentifierStorage.h
@@ -17,11 +17,11 @@
*/
//==============================================================================
-
#ifndef RIPPLE_TYPES_IDENTIFIERSTORAGE_H_INCLUDED
#define RIPPLE_TYPES_IDENTIFIERSTORAGE_H_INCLUDED
#include "beast/beast/FixedArray.h"
+#include "beast/beast/crypto/MurmurHash.h"
namespace ripple {