为什么 /dev/urandom 不阻塞?

Why does /dev/urandom not block?

我知道/dev/random阻塞等待更多的熵进来,但为什么/dev/urandom不阻塞?

因为它的目的不是阻塞。这就是它与 /dev/random 的真正区别。所以你不必担心阻塞,但是你从中得到的位可能不像从 /dev/random.

中得到的那样随机。

根据man page

If there is not sufficient entropy in the entropy pool, the returned values from /dev/urandom are theoretically vulnerable to a cryptographic attack on the algorithms used by the driver.

手册页添加:

Knowledge of how to do this is not available in the current unclassified literature, but it is theoretically possible that such an attack may exist.