aboutsummaryrefslogtreecommitdiff
path: root/src/random.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2016-10-18 15:38:44 +0200
committerWladimir J. van der Laan <[email protected]>2016-10-18 15:44:57 +0200
commitcdfb7755a6af2e95e8598ca8e8d6896c745bcd72 (patch)
treefce0cfa5a1d83ef5f9c6f84a6f0875bf1903323f /src/random.cpp
parentMerge #8935: Documentation: Building on Windows with WSL (diff)
parentKill insecure_random and associated global state (diff)
downloaddiscoin-cdfb7755a6af2e95e8598ca8e8d6896c745bcd72.tar.xz
discoin-cdfb7755a6af2e95e8598ca8e8d6896c745bcd72.zip
Merge #8914: Kill insecure_random and associated global state
5eaaa83 Kill insecure_random and associated global state (Wladimir J. van der Laan)
Diffstat (limited to 'src/random.cpp')
-rw-r--r--src/random.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/random.cpp b/src/random.cpp
index d9a8cc145..aa027e49c 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -178,22 +178,21 @@ uint256 GetRandHash()
return hash;
}
-uint32_t insecure_rand_Rz = 11;
-uint32_t insecure_rand_Rw = 11;
-void seed_insecure_rand(bool fDeterministic)
+FastRandomContext::FastRandomContext(bool fDeterministic)
{
// The seed values have some unlikely fixed points which we avoid.
if (fDeterministic) {
- insecure_rand_Rz = insecure_rand_Rw = 11;
+ Rz = Rw = 11;
} else {
uint32_t tmp;
do {
GetRandBytes((unsigned char*)&tmp, 4);
} while (tmp == 0 || tmp == 0x9068ffffU);
- insecure_rand_Rz = tmp;
+ Rz = tmp;
do {
GetRandBytes((unsigned char*)&tmp, 4);
} while (tmp == 0 || tmp == 0x464fffffU);
- insecure_rand_Rw = tmp;
+ Rw = tmp;
}
}
+