Merge branch 'bug/349/error_in_fc_crypto_rand_test' into 'develop'
Replace fc::random with std random generator See merge request PBSA/peerplays!110
This commit is contained in:
commit
564af2e19e
3 changed files with 20 additions and 8 deletions
|
|
@ -30,6 +30,8 @@
|
|||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <tuple>
|
||||
#include <random>
|
||||
|
||||
#include <boost/tuple/tuple.hpp>
|
||||
#include <boost/circular_buffer.hpp>
|
||||
|
||||
|
|
@ -67,7 +69,6 @@
|
|||
#include <fc/io/json.hpp>
|
||||
#include <fc/io/enum_type.hpp>
|
||||
#include <fc/io/raw_fwd.hpp>
|
||||
#include <fc/crypto/rand.hpp>
|
||||
#include <fc/network/rate_limiting.hpp>
|
||||
#include <fc/network/ip.hpp>
|
||||
|
||||
|
|
@ -829,7 +830,11 @@ namespace graphene { namespace net { namespace detail {
|
|||
_maximum_blocks_per_peer_during_syncing(GRAPHENE_NET_MAX_BLOCKS_PER_PEER_DURING_SYNCING)
|
||||
{
|
||||
_rate_limiter.set_actual_rate_time_constant(fc::seconds(2));
|
||||
fc::rand_bytes(&_node_id.data[0], (int)_node_id.size());
|
||||
|
||||
using bytes_randomizer = std::independent_bits_engine<std::default_random_engine, CHAR_BIT, unsigned long>;
|
||||
std::random_device rd;
|
||||
bytes_randomizer br(rd());
|
||||
std::generate(std::begin(_node_id.data), std::end(_node_id.data), std::ref(br));
|
||||
}
|
||||
|
||||
node_impl::~node_impl()
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include <sstream>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <random>
|
||||
|
||||
#include <boost/version.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
|
@ -62,7 +63,6 @@
|
|||
#include <fc/crypto/hex.hpp>
|
||||
#include <fc/thread/mutex.hpp>
|
||||
#include <fc/thread/scoped_lock.hpp>
|
||||
#include <fc/crypto/rand.hpp>
|
||||
|
||||
#include <graphene/app/api.hpp>
|
||||
#include <graphene/chain/asset_object.hpp>
|
||||
|
|
@ -7365,8 +7365,12 @@ signed_transaction wallet_api::rps_throw(game_id_type game_id,
|
|||
|
||||
// construct the complete throw, the commit, and reveal
|
||||
rock_paper_scissors_throw full_throw;
|
||||
fc::rand_bytes((char*)&full_throw.nonce1, sizeof(full_throw.nonce1));
|
||||
fc::rand_bytes((char*)&full_throw.nonce2, sizeof(full_throw.nonce2));
|
||||
std::random_device rd;
|
||||
std::mt19937_64 gen(rd());
|
||||
std::uniform_int_distribution<uint64_t> dis;
|
||||
full_throw.nonce1 = dis(gen);
|
||||
full_throw.nonce2 = dis(gen);
|
||||
|
||||
full_throw.gesture = gesture;
|
||||
|
||||
rock_paper_scissors_throw_commit commit_throw;
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include <graphene/chain/match_object.hpp>
|
||||
#include <graphene/chain/tournament_object.hpp>
|
||||
|
||||
#include <fc/crypto/rand.hpp>
|
||||
#include <random>
|
||||
|
||||
using namespace graphene::chain;
|
||||
|
||||
|
|
@ -276,8 +276,11 @@ void tournaments_helper::rps_throw(const game_id_type& game_id,
|
|||
|
||||
// construct the complete throw, the commit, and reveal
|
||||
rock_paper_scissors_throw full_throw;
|
||||
fc::rand_bytes((char*)&full_throw.nonce1, sizeof(full_throw.nonce1));
|
||||
fc::rand_bytes((char*)&full_throw.nonce2, sizeof(full_throw.nonce2));
|
||||
std::random_device rd;
|
||||
std::mt19937_64 gen(rd());
|
||||
std::uniform_int_distribution<uint64_t> dis;
|
||||
full_throw.nonce1 = dis(gen);
|
||||
full_throw.nonce2 = dis(gen);
|
||||
full_throw.gesture = gesture;
|
||||
|
||||
rock_paper_scissors_throw_commit commit_throw;
|
||||
|
|
|
|||
Loading…
Reference in a new issue