*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> arc4random_stir (3)              
Title
Content
Arch
Section
 

ARC4RANDOM(3)

Contents


NAME    [Toc]    [Back]

     arc4random, arc4random_stir, arc4random_addrandom -- arc4 random number
     generator

LIBRARY    [Toc]    [Back]

     Standard C Library (libc, -lc)

SYNOPSIS    [Toc]    [Back]

     #include <stdlib.h>

     u_int32_t
     arc4random(void);

     void
     arc4random_stir(void);

     void
     arc4random_addrandom(unsigned char *dat, int datlen);

DESCRIPTION    [Toc]    [Back]

     The arc4random() function uses the key stream generator employed by the
     arc4 cipher, which uses 8*8 8 bit S-Boxes.  The S-Boxes can be in about
     (2**1700) states.	The arc4random() function returns pseudo-random numbers
 in the range of 0 to (2**32)-1, and therefore has twice the range of
     rand(3) and random(3).

     The arc4random_stir() function reads data from /dev/urandom and uses it
     to permute the S-Boxes via arc4random_addrandom().

     There is no need to call arc4random_stir() before using arc4random(),
     since arc4random() automatically initializes itself.

EXAMPLES    [Toc]    [Back]

     The following produces a drop-in replacement for the traditional rand()
     and random() functions using arc4random():

	   #define foo4random() (arc4random() % ((unsigned)RAND_MAX + 1))

SEE ALSO    [Toc]    [Back]

      
      
     rand(3), random(3), srandomdev(3)

HISTORY    [Toc]    [Back]

     RC4 has been designed by RSA Data Security, Inc.  It was posted anonymously
 to the USENET and was confirmed to be equivalent by several
     sources who had access to the original cipher.  Since RC4 used to be a
     trade secret, the cipher is now referred to as ARC4.


FreeBSD 5.2.1			April 15, 1997			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
rand_r OpenBSD bad random number generator
rand Linux random number generator.
srand OpenBSD bad random number generator
rand_r NetBSD bad random number generator
rand OpenBSD bad random number generator
srand FreeBSD bad random number generator
sranddev FreeBSD bad random number generator
rand NetBSD bad random number generator
rand_r FreeBSD bad random number generator
rand FreeBSD bad random number generator
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service