reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
resip::Random Class Reference

A static class that wraps the random-number generation code of your platform. More...

#include <Random.hxx>

Public Types

enum  { maxLength = 512 }
 

Static Public Member Functions

static unsigned getSimpleSeed ()
 Key goal is to make sure that each thread has distinct seed.
 
static void initialize ()
 
static Data getRandom (unsigned int numBytes)
 
static Data getRandomHex (unsigned int numBytes)
 
static Data getRandomBase64 (unsigned int numBytes)
 
static Data getCryptoRandom (unsigned int numBytes)
 
static Data getCryptoRandomHex (unsigned int numBytes)
 
static Data getCryptoRandomBase64 (unsigned int numBytes)
 
static void getCryptoRandom (unsigned char *buf, unsigned int numBytes)
 
static Data getVersion4UuidUrn ()
 Returns a version 4 (random) UUID as defined in RFC 4122.
 
static int getRandom ()
 Returns a postive integer (31 bits) of randomness.
 
static int getCryptoRandom ()
 
static const char * getImplName ()
 

Detailed Description

A static class that wraps the random-number generation code of your platform.

Definition at line 53 of file Random.hxx.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
maxLength 

Definition at line 59 of file Random.hxx.

Member Function Documentation

◆ getCryptoRandom() [1/3]

int Random::getCryptoRandom ( )
static

Definition at line 330 of file Random.cxx.

◆ getCryptoRandom() [2/3]

void Random::getCryptoRandom ( unsigned char *  buf,
unsigned int  numBytes 
)
static

Definition at line 463 of file Random.cxx.

◆ getCryptoRandom() [3/3]

Data Random::getCryptoRandom ( unsigned int  numBytes)
static

Definition at line 374 of file Random.cxx.

◆ getCryptoRandomBase64()

Data Random::getCryptoRandomBase64 ( unsigned int  numBytes)
static

Definition at line 400 of file Random.cxx.

◆ getCryptoRandomHex()

Data Random::getCryptoRandomHex ( unsigned int  numBytes)
static

Definition at line 394 of file Random.cxx.

◆ getImplName()

const char * Random::getImplName ( )
static

Definition at line 79 of file Random.cxx.

◆ getRandom() [1/2]

int Random::getRandom ( )
static

Returns a postive integer (31 bits) of randomness.

Implementation is platform dependent.

Definition at line 261 of file Random.cxx.

◆ getRandom() [2/2]

Data Random::getRandom ( unsigned int  numBytes)
static

Definition at line 355 of file Random.cxx.

◆ getRandomBase64()

Data Random::getRandomBase64 ( unsigned int  numBytes)
static

Definition at line 388 of file Random.cxx.

◆ getRandomHex()

Data Random::getRandomHex ( unsigned int  numBytes)
static

Definition at line 382 of file Random.cxx.

◆ getSimpleSeed()

unsigned Random::getSimpleSeed ( )
static

Key goal is to make sure that each thread has distinct seed.

Definition at line 102 of file Random.cxx.

◆ getVersion4UuidUrn()

Data Random::getVersion4UuidUrn ( )
static

Returns a version 4 (random) UUID as defined in RFC 4122.

Todo:
This is something of a suboptimal hack. Ideally, we would encapsulate UUID as its own class, with options to create any of versions 1 through 5 (and Nil UUIDs). This class would have various access methods to pull the result out as a bitstring, as raw data, as a URN, etc. For what I need to do right now, however, version 4 UUIDs get me where I need to go. <abr>

Definition at line 436 of file Random.cxx.

◆ initialize()

void Random::initialize ( )
static

ah! blocks if /dev/random on embedded sys

Definition at line 125 of file Random.cxx.


The documentation for this class was generated from the following files: