#include <stdexcept>
#include <vector>
+
#include <openssl/bn.h>
+
#include "util.h"
+#include "uint256.h"
/** Errors thrown by the bignum class */
class bignum_error : public std::runtime_error
#include <stdio.h>
#include <string.h>
#include <cassert>
-#include <stdexcept>
+#include <stdexcept>
+
+#include <openssl/rand.h>
#include "uint256.h"
else
*this = 0;
}
+
+uint256 GetRandHash()
+{
+ uint256 hash;
+ RAND_bytes(hash.begin(), hash.size());
+ return hash;
+}
inline const uint256 operator+(const uint256& a, const uint256& b) { return (base_uint256)a + (base_uint256)b; }
inline const uint256 operator-(const uint256& a, const uint256& b) { return (base_uint256)a - (base_uint256)b; }
+uint256 GetRandHash();
+
#endif
return static_cast<int>(GetRand(nMax));
}
-uint256 GetRandHash()
-{
- uint256 hash;
- RAND_bytes(hash.begin(), hash.size());
- return hash;
-}
-
void FillRand(uint8_t *buffer, size_t nCount)
{
RAND_bytes(buffer, nCount);
#ifndef BITCOIN_UTIL_H
#define BITCOIN_UTIL_H
-
-#include "uint256.h"
-
#ifndef WIN32
#include <sys/types.h>
#include <sys/time.h>
void ShrinkDebugFile();
int GetRandInt(int nMax);
uint64_t GetRand(uint64_t nMax);
-uint256 GetRandHash();
void FillRand(uint8_t *buffer, size_t nCount);
int64_t GetTime();
int64_t GetTimeMillis();