diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 37ab76d0e..0c5580bd4 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -93,7 +93,7 @@ elseif (UNIX) endif() -find_package(Boost 1.54.0 REQUIRED COMPONENTS random) +find_package(Boost 1.54.0 REQUIRED COMPONENTS system) message(" - boost header: ${Boost_INCLUDE_DIRS}") message(" - boost lib : ${Boost_LIBRARIES}") diff --git a/libdevcore/FixedHash.cpp b/libdevcore/FixedHash.cpp index 420e2bb16..167f99a1a 100644 --- a/libdevcore/FixedHash.cpp +++ b/libdevcore/FixedHash.cpp @@ -20,31 +20,9 @@ */ #include "FixedHash.h" -#include #include using namespace std; using namespace dev; -boost::random_device dev::s_fixedHashEngine; - -h128 dev::fromUUID(std::string const& _uuid) -{ - try - { - return h128(boost::replace_all_copy(_uuid, "-", "")); - } - catch (...) - { - return h128(); - } -} - -std::string dev::toUUID(h128 const& _uuid) -{ - std::string ret = toHex(_uuid.ref()); - for (unsigned i: {20, 16, 12, 8}) - ret.insert(ret.begin() + i, '-'); - return ret; -} - +std::random_device dev::s_fixedHashEngine; \ No newline at end of file diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index 8beb3bec7..c09d54759 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -26,8 +26,7 @@ #include #include #include -#include -#include +#include #include "CommonData.h" namespace dev @@ -37,7 +36,7 @@ namespace dev template struct StaticLog2 { enum { result = 1 + StaticLog2::result }; }; template <> struct StaticLog2<1> { enum { result = 0 }; }; -extern boost::random_device s_fixedHashEngine; +extern std::random_device s_fixedHashEngine; /// Fixed-size raw-byte array container type, with an API optimised for storing hashes. /// Transparently converts to/from the corresponding arithmetic type; this will @@ -154,7 +153,7 @@ public: void randomize(Engine& _eng) { for (auto& i: m_data) - i = (uint8_t)boost::random::uniform_int_distribution(0, 255)(_eng); + i = (uint8_t)std::uniform_int_distribution(0, 255)(_eng); } /// @returns a random valued object. @@ -291,7 +290,6 @@ public: bytesConstRef ref() const { return FixedHash::ref(); } byte const* data() const { return FixedHash::data(); } - static SecureFixedHash random() { SecureFixedHash ret; ret.randomize(s_fixedHashEngine); return ret; } using FixedHash::firstBitSet; void clear() { ref().cleanse(); }