mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 22:25:04 -04:00
Added Ben's patches:
* Compilation for FreeBSD. * Notes that MT is not cryptographically secure. * modified sorting of DHT Window. Only one change that I didn't commit: bitdht { - LIBS += ../../libbitdht/src/lib/libbitdht.a - PRE_TARGETDEPS *= ../../libbitdht/src/lib/libbitdht.a + LIBS += ../../libbitdht/src/libbitdht.a + PRE_TARGETDEPS *= ../../libbitdht/src/libbitdht.a } As this would have broken compilation on the other platforms. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@4619 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
bb9f362458
commit
5ea8cfb67d
9 changed files with 62 additions and 12 deletions
|
@ -12,6 +12,9 @@ static bool auto_seed = bdRandom::seed( (time(NULL) + ((uint32_t) pthread_self()
|
|||
#else
|
||||
#ifdef __APPLE__
|
||||
static bool auto_seed = bdRandom::seed( (time(NULL) + pthread_mach_thread_np(pthread_self())*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
||||
#elif defined(__FreeBSD__)
|
||||
// since this is completely insecure anyway, just kludge for now
|
||||
static bool auto_seed = bdRandom::seed(time(NULL));
|
||||
#else
|
||||
static bool auto_seed = bdRandom::seed( (time(NULL) + pthread_self()*0x1293fe + (getpid()^0x113ef76b))^0x18e34a12 ) ;
|
||||
#endif
|
||||
|
|
|
@ -32,12 +32,15 @@
|
|||
// - thread safe
|
||||
// - system independant
|
||||
// - fast
|
||||
// - cryptographically safe
|
||||
// - NOT CRYPTOGRAPHICALLY SAFE
|
||||
// - DO NOT USE FOR ANYTHING REQUIRING STRONG RANDOMNESS
|
||||
//
|
||||
// The implementation is adapted from the Mersenne Twister page of Wikipedia.
|
||||
//
|
||||
// http://en.wikipedia.org/wiki/Mersenne_twister
|
||||
|
||||
// FIXME(ben): MT is not cryptographically safe.
|
||||
|
||||
#include <vector>
|
||||
#include "util/bdthreads.h"
|
||||
|
||||
|
@ -68,4 +71,4 @@ class bdRandom
|
|||
static std::vector<uint32_t> MT ;
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue