What is /dev/arandom?

2019-06-15 01:34发布

问题:

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?

回答1:

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.



回答2:

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.