BeeCrypt 4.2.1
mtprng.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1998, 1999, 2000, 2003 X-Way Rights BV
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 */
19
26#ifndef _MTPRNG_H
27#define _MTPRNG_H
28
29#include "beecrypt/beecrypt.h"
30
31#ifdef _REENTRANT
32# if WIN32
33# include <windows.h>
34# include <winbase.h>
35# endif
36#endif
37
38#define N 624
39#define M 397
40#define K 0x9908B0DFU
41
42/*
43 */
44#ifdef __cplusplus
46#else
47struct _mtprngParam
48#endif
49{
50 #ifdef _REENTRANT
51 bc_mutex_t lock;
52 #endif
53 uint32_t state[N+1];
54 uint32_t left;
55 uint32_t* nextw;
56};
57
58#ifndef __cplusplus
59typedef struct _mtprngParam mtprngParam;
60#endif
61
62#ifdef __cplusplus
63extern "C" {
64#endif
65
66/*
67 */
69
70/*
71 */
74
75/*
76 */
78int mtprngSeed (mtprngParam* mp, const byte* data, size_t size);
79
80/*
81 */
83int mtprngNext (mtprngParam* mp, byte* data, size_t size);
84
85/*
86 */
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif
#define BEECRYPTAPI
Definition api.h:52
BeeCrypt API, headers.
pthread_mutex_t bc_mutex_t
Definition gnu.h:46
#define N
Definition mtprng.h:38
int mtprngSeed(mtprngParam *mp, const byte *data, size_t size)
int mtprngCleanup(mtprngParam *mp)
int mtprngSetup(mtprngParam *mp)
const randomGenerator mtprng
int mtprngNext(mtprngParam *mp, byte *data, size_t size)
Definition mtprng.h:49
uint32_t * nextw
Definition mtprng.h:55
uint32_t left
Definition mtprng.h:54
This struct holds information and pointers to code specific to each pseudo-random number generator.
Definition beecrypt.h:165