A couple useful tidbits about the Linux /dev/random and /dev/urandom devices

Linux contains two devices that provide a source of entropy for the system. The first device is /dev/random, and the second is /dev/urandom. /dev/random is a character special device that provides a source of entropy until the system-wide entropy pool is exhausted, at which time it will block until additional entropy is available. /dev/urandom is a character device that uses the system entropy pool until it is depleted, then falls back to a pseudo-random number generator.

To gain access to the system wide entropy pool, you can use the openssl utilities “rand” option:

$ openssl rand -base64 16

Or dump out the /dev/random and /dev/urandom devices with cat and company.

1 thought on “A couple useful tidbits about the Linux /dev/random and /dev/urandom devices”

Leave a Reply

Your email address will not be published. Required fields are marked *