genrandom 876 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. .TH GENRANDOM 2
  2. .SH NAME
  3. genrandom, 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
  14. void genrandom(uchar *buf, int nbytes)
  15. .PP
  16. .B
  17. void prng(uchar *buf, int nbytes)
  18. .SH DESCRIPTION
  19. .PP
  20. Most security software requires a source of random or, at the
  21. very least, unguessable numbers.
  22. .PP
  23. .I Genrandom
  24. fills a buffer with bytes from the X9.17 pseudo-random
  25. number generator. The X9.17 generator is seeded by 24
  26. truly random bytes read from
  27. .BR /dev/random .
  28. .PP
  29. .I Prng
  30. uses the native
  31. .IR rand (2)
  32. pseudo-random number generator to fill the buffer. Used with
  33. .IR srand ,
  34. this function can produce a reproducible stream of pseudo random
  35. numbers useful in testing.
  36. .PP
  37. Both functions may be passed to
  38. .I mprand
  39. (see
  40. .IR mp (2)).
  41. .SH SOURCE
  42. .B /sys/src/libsec
  43. .SH SEE ALSO
  44. .IR mp (2)