Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Mar 1997 17:02:20 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        FreeBSD-hackers@freebsd.org, guido@gvr.win.tue.nl
Subject:   Re: random in kernel
Message-ID:  <199703240602.RAA32043@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I see a random() in libkern. I'm wondering why we cannot
>use get_random_bytes() in stead. This gives a much better randomness..

Because get_random_bytes() is much slower than random() and returns only
a limit number of truly random numbers.

I timed random() and read_random_unlimited() (which is similar to
get_randon_bytes()) except it returns an unlimited number of bytes)
on a P5/133:

libc random():                               76 nsec/Byte
kernel random():                            170 nsec/Byte (14 Instructions/B)
read_random_unlimited(4 bytes at a time): 11780 nsec/Byte (> 1200 I/B!)
                                                          (> 5000 I/B for new B)

Bruce



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