Deleted Added
full compact
arc4random.3 (52671) arc4random.3 (57686)
1.\" $OpenBSD: arc4random.3,v 1.2 1997/04/27 22:40:25 angelos Exp $
2.\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\" notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\" notice, this list of conditions and the following disclaimer in the
12.\" documentation and/or other materials provided with the distribution.
13.\" 3. All advertising materials mentioning features or use of this software
14.\" must display the following acknowledgement:
15.\" This product includes software developed by Niels Provos.
16.\" 4. The name of the author may not be used to endorse or promote products
17.\" derived from this software without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29.\"
30.\" Manual page, using -mandoc macros
1.\" $OpenBSD: arc4random.3,v 1.2 1997/04/27 22:40:25 angelos Exp $
2.\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\" notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\" notice, this list of conditions and the following disclaimer in the
12.\" documentation and/or other materials provided with the distribution.
13.\" 3. All advertising materials mentioning features or use of this software
14.\" must display the following acknowledgement:
15.\" This product includes software developed by Niels Provos.
16.\" 4. The name of the author may not be used to endorse or promote products
17.\" derived from this software without specific prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29.\"
30.\" Manual page, using -mandoc macros
31.\" $FreeBSD: head/lib/libc/gen/arc4random.3 52671 1999-10-30 15:12:25Z phantom $
31.\" $FreeBSD: head/lib/libc/gen/arc4random.3 57686 2000-03-02 09:14:21Z sheldonh $
32.\"
33.Dd April 15, 1997
34.Dt ARC4RANDOM 3
35.Os
36.Sh NAME
37.Nm arc4random ,
38.Nm arc4random_stir ,
39.Nm arc4random_addrandom
40.Nd arc4 random number generator.
41.Sh SYNOPSIS
42.Fd #include <stdlib.h>
43.Ft u_int32_t
44.Fn arc4random "void"
45.Ft void
46.Fn arc4random_stir "void"
47.Ft void
48.Fn arc4random_addrandom "unsigned char *dat" "int datlen"
49.Sh DESCRIPTION
50The
51.Fn arc4random
52function uses the key stream generator employed by the
32.\"
33.Dd April 15, 1997
34.Dt ARC4RANDOM 3
35.Os
36.Sh NAME
37.Nm arc4random ,
38.Nm arc4random_stir ,
39.Nm arc4random_addrandom
40.Nd arc4 random number generator.
41.Sh SYNOPSIS
42.Fd #include <stdlib.h>
43.Ft u_int32_t
44.Fn arc4random "void"
45.Ft void
46.Fn arc4random_stir "void"
47.Ft void
48.Fn arc4random_addrandom "unsigned char *dat" "int datlen"
49.Sh DESCRIPTION
50The
51.Fn arc4random
52function uses the key stream generator employed by the
53arc4 cipher, which uses 8*8 8 bit S-Boxes. The S-Boxes
53arc4 cipher, which uses 8*8 8 bit S-Boxes.
54The S-Boxes
54can be in about
55.if t 2\u\s71700\s10\d
56.if n (2**1700)
57states.
58.Pp
59The
60.Fn arc4random_stir
61function reads data from
62.Pa /dev/urandom
63and uses it to permute the S-Boxes via
64.Fn arc4random_addrandom .
65.Pp
66There is no need to call
67.Fn arc4random_stir
68before using
69.Fn arc4random ,
70since
71.Fn arc4random
72automatically initializes itself.
73.Sh SEE ALSO
74.Xr rand 3 ,
75.Xr random 3 ,
76.Xr srandomdev 3
77.Sh HISTORY
78.Pa RC4
55can be in about
56.if t 2\u\s71700\s10\d
57.if n (2**1700)
58states.
59.Pp
60The
61.Fn arc4random_stir
62function reads data from
63.Pa /dev/urandom
64and uses it to permute the S-Boxes via
65.Fn arc4random_addrandom .
66.Pp
67There is no need to call
68.Fn arc4random_stir
69before using
70.Fn arc4random ,
71since
72.Fn arc4random
73automatically initializes itself.
74.Sh SEE ALSO
75.Xr rand 3 ,
76.Xr random 3 ,
77.Xr srandomdev 3
78.Sh HISTORY
79.Pa RC4
79has been designed by RSA Data Security, Inc. It was posted anonymously
80has been designed by RSA Data Security, Inc.
81It was posted anonymously
80to the USENET and was confirmed to be equivalent by several sources who
82to the USENET and was confirmed to be equivalent by several sources who
81had access to the original cipher. Since
83had access to the original cipher.
84Since
82.Pa RC4
83used to be a trade secret, the cipher is now referred to as
84.Pa ARC4 .
85.Pa RC4
86used to be a trade secret, the cipher is now referred to as
87.Pa ARC4 .