mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
using new random generator for turtle tunnel ids.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3490 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
4ea6b0b31f
commit
64e66f7f4c
@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
#include "util/rsdebug.h"
|
#include "util/rsdebug.h"
|
||||||
#include "util/rsprint.h"
|
#include "util/rsprint.h"
|
||||||
|
#include "util/rsrandom.h"
|
||||||
#include "pqi/pqinetwork.h"
|
#include "pqi/pqinetwork.h"
|
||||||
|
|
||||||
// These number may be quite important. I setup them with sensible values, but
|
// These number may be quite important. I setup them with sensible values, but
|
||||||
@ -537,19 +538,21 @@ bool p3turtle::loadList(std::list<RsItem*> load)
|
|||||||
//
|
//
|
||||||
uint32_t p3turtle::generateRandomRequestId()
|
uint32_t p3turtle::generateRandomRequestId()
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
return RSRandom::random_u32() ;
|
||||||
|
|
||||||
static uint64_t s = time(NULL) ;
|
// RsStackMutex stack(mTurtleMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
//
|
||||||
s = s*1664525 + 1013904223 ; // pseudo random number generator from Wikipedia/Numerical Recipies.
|
// static uint64_t s = time(NULL) ;
|
||||||
|
//
|
||||||
return (uint32_t)(s & 0x00000000ffffffff) ;
|
// s = s*1664525 + 1013904223 ; // pseudo random number generator from Wikipedia/Numerical Recipies.
|
||||||
|
//
|
||||||
|
// return (uint32_t)(s & 0x00000000ffffffff) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t p3turtle::generatePersonalFilePrint(const TurtleFileHash& hash,bool b)
|
uint32_t p3turtle::generatePersonalFilePrint(const TurtleFileHash& hash,bool b)
|
||||||
{
|
{
|
||||||
// whatever cooking from the file hash and OwnId that cannot be recovered.
|
// whatever cooking from the file hash and OwnId that cannot be recovered.
|
||||||
// The only important thing is that the saem hash produces the same tunnel
|
// The only important thing is that the saem couple (hash,SSL id) produces the same tunnel
|
||||||
// id. The result uses a boolean to allow generating non symmetric tunnel ids.
|
// id. The result uses a boolean to allow generating non symmetric tunnel ids.
|
||||||
|
|
||||||
std::string buff(hash + mConnMgr->getOwnId()) ;
|
std::string buff(hash + mConnMgr->getOwnId()) ;
|
||||||
|
Loading…
Reference in New Issue
Block a user