Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is /dev/arandom?

This manual page says:

Note: As of PHP 5.4.0 session.entropy_file defaults to /dev/urandom or /dev/arandom if it is available. In PHP 5.3.0 this directive is left empty by default.

So, what's /dev/arandom and how does it differ from /dev/[u]random?

like image 244
Alix Axel Avatar asked Oct 14 '12 21:10

Alix Axel


People also ask

What is urandom used for?

The /dev/random and /dev/urandom files are special files that are a source for random bytes generated by the kernel random number generator device. The /dev/random and /dev/urandom files are suitable for applications requiring high quality random numbers for cryptographic purposes.

What does Dev urandom do in Linux?

The character special files /dev/random and /dev/urandom (present since Linux 1.3. 30) provide an interface to the kernel's random number generator. The file /dev/random has major device number 1 and minor device number 8. The file /dev/urandom has major device number 1 and minor device number 9.

What is Dev random vs Dev urandom?

'Urandom' is used where there is constant need of random numbers and its randomness is not much important while 'random' is used where there is a security concern and its randomness should be reliable as it blocks outputting random numbers if entropy is not up to the mark.

Is Dev urandom random?

The /dev/urandom device provides a reliable source of random output, however the output will not be generated from an equal amount of random input if insufficient input is available. Reads from the /dev/urandom device always return the quantity of output requested without blocking.


2 Answers

From here. It appears as though arandom will guarantee that sufficient entropy is present before returning the amount of data requested. It also appears to be limited to OpenBSD implementations. urandom will return the amount of data requested no matter whether there is enough entropy -- which obviously could introduce a vulnerability if there is not enough.

like image 108
Chris Thompson Avatar answered Sep 25 '22 20:09

Chris Thompson


This page does a reasonable job explaining what the device is:

As required, entropy pool data re-seeds an ARC4 generator, which then generates high-quality pseudo-random output data.

More information about the underlying technique is available from Wikipedia.

like image 31
ta.speot.is Avatar answered Sep 27 '22 20:09

ta.speot.is