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

beecrypt/mtprng.c File Reference

Mersenne Twister pseudo-random number generator, code. More...

#include "system.h"
#include "beecrypt.h"
#include "mtprng.h"
#include "mp32opt.h"
#include "mp32.h"
#include "debug.h"

Go to the source code of this file.

Defines

#define hiBit(a)   ((a) & 0x80000000)
#define loBit(a)   ((a) & 0x1)
#define loBits(a)   ((a) & 0x7FFFFFFF)
#define mixBits(a, b)   (hiBit(a) | loBits(b))

Functions

void mtprngReload (mtprngParam *mp)
int mtprngSetup (mtprngParam *mp)
int mtprngSeed (mtprngParam *mp, const uint32 *data, int size)
int mtprngNext (mtprngParam *mp, uint32 *data, int size)
int mtprngCleanup (mtprngParam *mp)

Variables

const randomGenerator mtprng = { "Mersenne Twister", sizeof(mtprngParam), (randomGeneratorSetup) mtprngSetup, (randomGeneratorSeed) mtprngSeed, (randomGeneratorNext) mtprngNext, (randomGeneratorCleanup) mtprngCleanup }


Detailed Description

Mersenne Twister pseudo-random number generator, code.

Developed by Makoto Matsumoto and Takuji Nishimura

For more information, see: http://www.math.keio.ac.jp/~matumoto/emt.html

Adapted from optimized code by Shawn J. Cokus <cokus@math.washington.edu>

Note: this generator has a very long period, passes statistical test, but needs more study to determine whether it is cryptographically strong enough.

Definition in file mtprng.c.


Define Documentation

#define hiBit (  a    )     ((a) & 0x80000000)
 

Definition at line 45 of file mtprng.c.

#define loBit (  a    )     ((a) & 0x1)
 

Definition at line 46 of file mtprng.c.

Referenced by mtprngReload.

#define loBits (  a    )     ((a) & 0x7FFFFFFF)
 

Definition at line 47 of file mtprng.c.

#define mixBits (  a,
b    )     (hiBit(a) | loBits(b))
 

Definition at line 48 of file mtprng.c.

Referenced by mtprngReload.


Function Documentation

int mtprngCleanup (  mtprngParam *    mp ) 
 

Definition at line 220 of file mtprng.c.

int mtprngNext (  mtprngParam *    mp,
uint32 *    data,
int    size
) 
 

Definition at line 161 of file mtprng.c.

References mtprngParam::left, mtprngReload, mtprngParam::nextw, and uint32.

void mtprngReload (  mtprngParam *    mp )  [static]
 

Definition at line 57 of file mtprng.c.

References K, loBit, M, mixBits, N, and uint32.

Referenced by mtprngNext.

int mtprngSeed (  mtprngParam *    mp,
const uint32 *    data,
int    size
) 
 

Definition at line 108 of file mtprng.c.

References mp32copy, N, mtprngParam::state, and uint32.

int mtprngSetup (  mtprngParam *    mp ) 
 

Definition at line 77 of file mtprng.c.

References entropyGatherNext, mtprngParam::left, N, and mtprngParam::state.


Variable Documentation

const randomGenerator mtprng = { "Mersenne Twister", sizeof(mtprngParam), (randomGeneratorSetup) mtprngSetup, (randomGeneratorSeed) mtprngSeed, (randomGeneratorNext) mtprngNext, (randomGeneratorCleanup) mtprngCleanup }
 

Definition at line 51 of file mtprng.c.


Generated on Wed Sep 4 12:49:59 2002 for rpm by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002