Dynalib Utils
ISAAC64Random.h
Go to the documentation of this file.
1 //
2 // Created by Ken Kopelson on 27/04/18.
3 //
4 
5 /*
6 ------------------------------------------------------------------------------
7 ISAAC64Random.h: definitions for a crypto number generator
8 Bob Jenkins, 1996, Public Domain
9 ------------------------------------------------------------------------------
10 */
11 #ifndef STANDARD
12 #include "standard.h"
13 #endif
14 
15 #ifndef ISAAC64
16 #define ISAAC64
17 
18 #include <cstdint>
19 #include <cstddef>
20 #include "../TypeDefs.h"
21 
22 using namespace std;
23 
24 #define RANDSIZL (8)
25 #define RANDSIZ (1<<RANDSIZL)
26 
27 struct Rand64Context {
28  uint64_t randcnt;
29  uint64_t randrsl[RANDSIZ];
30  uint64_t randmem[RANDSIZ];
31  uint64_t randa;
32  uint64_t randb;
33  uint64_t randc;
34 };
35 
36 /*
37 ------------------------------------------------------------------------------
38  If (flag==TRUE), then use the contents of randrsl[0..255] as the seed.
39 ------------------------------------------------------------------------------
40 */
41 extern void isaac64Seed(char* seed, Rand64Context* ctx);
42 extern void isaac64Init(bool hasSeed, Rand64Context* ctx);
43 extern void isaac64Random(Rand64Context* ctx);
44 extern uint64_t rand64Int(Rand64Context* ctx);
45 extern void rand64Bytes(Rand64Context* ctx, uint8_t* buf, int count);
46 
47 #endif /* RAND */
uint64_t rand64Int(Rand64Context *ctx)
Definition: ISAAC64Random.cpp:137
void isaac64Random(Rand64Context *ctx)
Definition: ISAAC64Random.cpp:121
uint64_t randb
Definition: ISAAC64Random.h:32
void isaac64Seed(char *seed, Rand64Context *ctx)
Definition: ISAAC64Random.cpp:45
Definition: ISAAC64Random.h:27
uint64_t randc
Definition: ISAAC64Random.h:33
uint64_t randa
Definition: ISAAC64Random.h:31
void rand64Bytes(Rand64Context *ctx, uint8_t *buf, int count)
Definition: ISAAC64Random.cpp:145
void isaac64Init(bool hasSeed, Rand64Context *ctx)
Definition: ISAAC64Random.cpp:59
uint64_t randcnt
Definition: ISAAC64Random.h:28
#define RANDSIZ
Definition: ISAAC64Random.h:25