Tizen 2.0 Release
[external/tizen-coreutils.git] / lib / rand-isaac.h
1 /* Bob Jenkins's cryptographic random number generator, ISAAC.
2
3    Copyright (C) 1999-2005 Free Software Foundation, Inc.
4    Copyright (C) 1997, 1998, 1999 Colin Plumb.
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2, or (at your option)
9    any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software Foundation,
18    Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
20    Written by Colin Plumb.  */
21
22 #ifndef RAND_ISAAC_H
23 # define RAND_ISAAC_H
24
25 # include <stdint.h>
26
27 /* Size of the state tables to use.  ISAAC_LOG should be at least 3,
28    and smaller values give less security.  */
29 # define ISAAC_LOG 8
30 # define ISAAC_WORDS (1 << ISAAC_LOG)
31 # define ISAAC_BYTES (ISAAC_WORDS * sizeof (uint32_t))
32
33 /* RNG state variables.  The members of this structure are private.  */
34 struct isaac_state
35   {
36     uint32_t mm[ISAAC_WORDS];   /* Main state array */
37     uint32_t iv[8];             /* Seeding initial vector */
38     uint32_t a, b, c;           /* Extra index variables */
39   };
40
41 void isaac_seed (struct isaac_state *);
42 void isaac_refill (struct isaac_state *, uint32_t[ISAAC_WORDS]);
43
44 #endif