]> git.saurik.com Git - apple/xnu.git/blob - bsd/man/man4/random.4
xnu-7195.101.1.tar.gz
[apple/xnu.git] / bsd / man / man4 / random.4
1 .Dd September 6, 2001
2 .Dt RANDOM 4
3 .Os Darwin
4 .Sh NAME
5 .Nm random
6 ,
7 .Nm urandom
8 .Nd random data source devices.
9 .Sh SYNOPSIS
10 .Cd "pseudo-device random"
11 .Sh DESCRIPTION
12 The
13 .Nm
14 device produces uniformly distributed random byte values
15 of potentially high quality.
16 .Pp
17 To obtain random bytes, open
18 .Nm /dev/random
19 for reading and read from it.
20 .Pp
21 The same random data is also available from
22 .Xr getentropy 2 .
23 Using the
24 .Xr getentropy 2
25 system call interface will provide resiliency to file descriptor exhaustion, chroot, or sandboxing which can make
26 .Nm /dev/random
27 unavailable. Additionally, the
28 .Xr arc4random 3
29 API provides a fast userspace random number generator built on the
30 .Nm
31 data source and is preferred over directly accessing the system's random device.
32 .Pp
33 .Nm /dev/urandom
34 is a compatibility nod to Linux. On Linux,
35 .Nm /dev/urandom
36 will produce lower quality output if the entropy pool drains, while
37 .Nm /dev/random
38 will prefer to block and wait for additional entropy to be collected.
39 With Fortuna, this choice and distinction is not necessary, and
40 the two devices behave identically. You may use either.
41 .Pp
42 The
43 .Nm
44 device implements the
45 .Nm Fortuna
46 pseudo random number generator algorithm and maintains its entropy pool.
47 The kernel automatically seeds the algorithm with additional entropy during normal execution.
48 .Sh FILES
49 .Bl -tag -width /dev/urandom -compact
50 .It Pa /dev/random
51 .It Pa /dev/urandom
52 .El
53 .Sh HISTORY
54 A
55 .Nm
56 device appeared in the Linux operating system.