diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj
index 1be97fbee6..cbd0d1b6c9 100644
--- a/Builds/VisualStudio2015/RippleD.vcxproj
+++ b/Builds/VisualStudio2015/RippleD.vcxproj
@@ -3007,6 +3007,10 @@
True
True
+
+ True
+ True
+
True
True
diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters
index 82f225507a..c07a78c604 100644
--- a/Builds/VisualStudio2015/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters
@@ -3726,6 +3726,9 @@
ripple\protocol\tests
+
+ ripple\protocol\tests
+
ripple\protocol\tests
diff --git a/src/BeastConfig.h b/src/BeastConfig.h
index 1bd6e0867d..9a3ef01012 100644
--- a/src/BeastConfig.h
+++ b/src/BeastConfig.h
@@ -173,7 +173,7 @@
// Uses OpenSSL instead of alternatives
#ifndef RIPPLE_USE_OPENSSL
-#define RIPPLE_USE_OPENSSL 0
+#define RIPPLE_USE_OPENSSL 1
#endif
#endif
diff --git a/src/ripple/protocol/tests/digest_test.cpp b/src/ripple/protocol/tests/digest_test.cpp
new file mode 100644
index 0000000000..93e571b475
--- /dev/null
+++ b/src/ripple/protocol/tests/digest_test.cpp
@@ -0,0 +1,163 @@
+//------------------------------------------------------------------------------
+/*
+ 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.
+*/
+//==============================================================================
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+namespace ripple {
+
+class digest_test : public beast::unit_test::suite
+{
+ std::vector dataset1;
+
+ template
+ void test (char const* name)
+ {
+ using namespace std::chrono;
+
+ // Prime the cache
+ for (int i = 0; i != 4; i++)
+ {
+ for (auto const& x : dataset1)
+ {
+ Hasher h;
+ h (x.data (), x.size ());
+ auto r = static_cast(h);
+ }
+ }
+
+ std::array results;
+
+ for (auto& result : results)
+ {
+ auto const start = high_resolution_clock::now ();
+
+ for (auto const& x : dataset1)
+ {
+ Hasher h;
+ h (x.data (), x.size ());
+ auto r = static_cast(h);
+ }
+
+ auto const d = high_resolution_clock::now () - start;
+
+ result = d;
+ }
+
+ log << " " << name << ":";
+
+ auto const sum = std::accumulate(
+ results.begin(), results.end(),
+ nanoseconds{0});
+ {
+ auto s = duration_cast(sum);
+ auto ms = duration_cast(sum) - s;
+ log <<
+ " Total Time = " << s.count() <<
+ "." << ms.count() << " seconds";
+ }
+
+ auto const mean = sum / results.size();
+ {
+ auto s = duration_cast(mean);
+ auto ms = duration_cast(mean) - s;
+ log <<
+ " Mean Time = " << s.count() <<
+ "." << ms.count() << " seconds";
+ }
+
+ std::vector diff(results.size());
+ std::transform(
+ results.begin(), results.end(), diff.begin(),
+ [&mean](nanoseconds trial)
+ {
+ return (trial - mean).count();
+ });
+ auto const sq_sum = std::inner_product(
+ diff.begin(), diff.end(), diff.begin(), 0.0);
+ {
+ nanoseconds const stddev {
+ static_cast(
+ std::sqrt(sq_sum / results.size()))
+ };
+ auto s = duration_cast(stddev);
+ auto ms = duration_cast(stddev) - s;
+ log <<
+ " Std Dev = " << s.count() <<
+ "." << ms.count() << " seconds";
+ }
+ }
+
+public:
+ digest_test ()
+ {
+ beast::xor_shift_engine g(19207813);
+ std::uint8_t buf[32];
+
+ for (int i = 0; i < 1000000; i++)
+ {
+ beast::rngfill (buf, sizeof(buf), g);
+ dataset1.push_back (uint256::fromVoid (buf));
+ }
+ }
+
+ void testSHA512 ()
+ {
+ testcase ("SHA512");
+ test ("OpenSSL");
+ test ("Beast");
+ pass ();
+ }
+
+ void testSHA256 ()
+ {
+ testcase ("SHA256");
+ test ("OpenSSL");
+ test ("Beast");
+ pass ();
+ }
+
+ void testRIPEMD160 ()
+ {
+ testcase ("RIPEMD160");
+ test ("OpenSSL");
+ test ("Beast");
+ pass ();
+ }
+
+ void run ()
+ {
+ testSHA512 ();
+ testSHA256 ();
+ testRIPEMD160 ();
+ }
+};
+
+BEAST_DEFINE_TESTSUITE_MANUAL(digest,ripple_data,ripple);
+
+} // ripple
diff --git a/src/ripple/unity/protocol.cpp b/src/ripple/unity/protocol.cpp
index 982460800f..15fac6e004 100644
--- a/src/ripple/unity/protocol.cpp
+++ b/src/ripple/unity/protocol.cpp
@@ -64,6 +64,7 @@
#include
+#include
#include
#include
#include