blob: ddf481e4c5127289cc14ab42c65e93f7950f83d2 [file] [log] [blame]
rsccfa37a72004-04-10 18:53:55 +00001.TH GENRANDOM 3
2.SH NAME
3genrandom, prng \- random number generation
4.SH SYNOPSIS
5.B #include <u.h>
6.br
7.B #include <libc.h>
8.br
9.B #include <mp.h>
10.br
11.B #include <libsec.h>
12.PP
13.B
14void genrandom(uchar *buf, int nbytes)
15.PP
16.B
17void prng(uchar *buf, int nbytes)
18.SH DESCRIPTION
rsccfa37a72004-04-10 18:53:55 +000019Most security software requires a source of random or, at the
20very least, unguessable numbers.
21.PP
22.I Genrandom
23fills a buffer with bytes from the X9.17 pseudo-random
24number generator. The X9.17 generator is seeded by 24
rscc8b63422005-01-13 04:49:19 +000025truly random bytes read via
26.I truerand
27(see
28.IR rand (3)).
rsccfa37a72004-04-10 18:53:55 +000029.PP
30.I Prng
31uses the native
rscbf8a59f2004-04-11 03:42:27 +000032.IR rand (3)
rsccfa37a72004-04-10 18:53:55 +000033pseudo-random number generator to fill the buffer. Used with
34.IR srand ,
35this function can produce a reproducible stream of pseudo random
36numbers useful in testing.
37.PP
38Both functions may be passed to
39.I mprand
40(see
rscbf8a59f2004-04-11 03:42:27 +000041.IR mp (3)).
rsccfa37a72004-04-10 18:53:55 +000042.SH SOURCE
rscc3674de2005-01-11 17:37:33 +000043.B \*9/src/libsec
rsccfa37a72004-04-10 18:53:55 +000044.SH SEE ALSO
rscbf8a59f2004-04-11 03:42:27 +000045.IR mp (3)