What is /dev/arandom?

2019-06-15 01:48发布

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?

2条回答
【Aperson】
2楼-- · 2019-06-15 02:12

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.

查看更多
成全新的幸福
3楼-- · 2019-06-15 02:30

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.

查看更多
登录 后发表回答