Main Page Modules Data Structures File List Data Fields Globals Related Pages

# Pseudo-Random Number Generators

## Data Structures
struct | randomGenerator
struct | randomGeneratorContext
## Pseudo-random Number Generators
typedef void | randomGeneratorParam
typedef int(* | randomGeneratorSetup )(randomGeneratorParam *param)
typedef int(* | randomGeneratorSeed )(randomGeneratorParam *param, const uint32 *data, int size)
typedef int(* | randomGeneratorNext )(randomGeneratorParam *param, uint32 *data, int size)
typedef int(* | randomGeneratorCleanup )(randomGeneratorParam *param)
int | randomGeneratorCount (void)
const randomGenerator * | randomGeneratorGet (int index)
const randomGenerator * | randomGeneratorFind (const char *name)
const randomGenerator * | randomGeneratorDefault (void)
int | randomGeneratorContextInit (randomGeneratorContext *ctxt, const randomGenerator *rng)
int | randomGeneratorContextFree (randomGeneratorContext *ctxt)
int | randomGeneratorContextNext (randomGeneratorContext *ctxt, uint32 *data, int size)

## Typedef Documentation

typedef int(* randomGeneratorCleanup)(randomGeneratorParam* param)

  | Cleanup after using a generator. Parameters:
  param | generator parameters
Returns: 0 on success, -1 on failure Definition at line 164 of file beecrypt.h.

typedef int(* randomGeneratorNext)(randomGeneratorParam* param, uint32* data, int size)

  | Return an array of 32-bit unsigned integers of given size with pseudo-random data. Parameters:
  param | generator parameters
  Return values:
  data | pseudo-random data
  Parameters:
  size | no. of ints of data
Returns: 0 on success, -1 on failure Definition at line 155 of file beecrypt.h.

typedef void randomGeneratorParam

| Definition at line 123 of file beecrypt.h. Referenced by randomGeneratorContextFree, and randomGeneratorContextInit.

typedef int(* randomGeneratorSeed)(randomGeneratorParam* param, const uint32* data, int size)

  | Re-seed the random generator with user-provided entropy. Parameters:
  param | generator parameters
  data | user entropy
  size | no. of ints of entropy
Returns: 0 on success, -1 on failure Definition at line 143 of file beecrypt.h.

typedef int(* randomGeneratorSetup)(randomGeneratorParam* param)

  | Initialize the parameters for use, and seed the generator with entropy from the default entropy source. Parameters:
  param | generator parameters
Returns: 0 on success, -1 on failure Definition at line 132 of file beecrypt.h.

## Function Documentation

int randomGeneratorContextFree | ( | randomGeneratorContext * | ctxt | ) |

| Destroy a randomGenerator instance. Definition at line 231 of file beecrypt.c.

int randomGeneratorContextInit | ( | randomGeneratorContext * | ctxt,
|  | const randomGenerator * | rng
| ) |

| Initialize a randomGenerator instance. Definition at line 210 of file beecrypt.c. References BEECRYPTAPI.

int randomGeneratorContextNext | ( | randomGeneratorContext * | ctxt,
|  | uint32 * | data,
|  | int | size
| ) |

| Definition at line 257 of file beecrypt.c. References BEECRYPTAPI, and uint32.

int randomGeneratorCount | ( | void |  | ) |

| Return the number of generators available. Returns: number of generators available Definition at line 165 of file beecrypt.c.

const randomGenerator* randomGeneratorDefault | ( | void |  | ) |

| Retrieve the default generator. If the BEECRYPT_RANDOM environment variable is set, use that generator. Otherwise, use "fips186prng". Returns: generator pointer Definition at line 198 of file beecrypt.c.

const randomGenerator* randomGeneratorFind | ( | const char * | name | ) |

  | Retrieve a generator by name. Parameters:
  name | generator name
Returns: generator pointer (or NULL) Definition at line 183 of file beecrypt.c. Referenced by randomGeneratorDefault.

const randomGenerator* randomGeneratorGet | ( | int | index | ) |

  | Retrieve a generator by index. Parameters:
  index | generator index
Returns: generator pointer (or NULL) Definition at line 170 of file beecrypt.c.