Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 May 2005 18:18:18 -0700
From:      Kris Kennaway <kris@obsecurity.org>
To:        Nicolas Blais <nb_root@videotron.ca>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: srandomdev() vs srandom() vs arc4random()
Message-ID:  <20050525011818.GA7992@xor.obsecurity.org>
In-Reply-To: <200505242113.54226.nb_root@videotron.ca>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Tue, May 24, 2005 at 09:13:45PM -0400, Nicolas Blais wrote:
> I'm developping a software that uses random generated numbers. Since these 
> numbers must be as "chaotic" as possible, I'm using srandomdev(). My problem 
> is that I'm only able to compile my software on *BSD and certain distros of 
> Linux seem to be stripped of the call. This forces me to rely on 
> srandom(time(NULL)) for portability.
> 
> I would like to know how "random" (that is, how inprobable a pattern will 
> appear) if I use srandom(time(NULL)) instead of srandomdev().
>
> Also, would arc4random() be any better in getting the least pattern creation.

arc4random() should produce higher quality randomness, although
srandom() may be good enough for your needs.

> Finally, is there is a way to check if the call srandomdev() exists on other 
> OSes?

Sure, compile a test app in your configure script :-)

Kris
[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (FreeBSD)

iD8DBQFCk9JaWry0BWjoQKURAlPlAKCZU3su3Fo5FRvpkziE5A/mIM/0sQCgjmaX
IL8O4VDz97FTTN0R+7NRliM=
=tG7b
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050525011818.GA7992>