Skip to content
Tech News
← Back to articles

Myths about /dev/urandom (2014)

read original more articles
Why This Matters

This article clarifies common misconceptions about /dev/urandom and /dev/random, emphasizing that both use the same cryptographically secure pseudorandom number generator. It highlights that /dev/urandom is generally suitable for cryptographic purposes, and the perceived security differences are outdated, making it a reliable choice for developers and security professionals. Understanding these nuances helps improve security practices and dispels unnecessary fears about entropy and randomness sources in Linux systems.

Key Takeaways

Myths about /dev/urandom

Note from 2024: This article was published on March 16th, 2014 . It is still correct in its discussion of entropy and randomness, but the Linux kernel random number generator has been reworked several times since then and does not look like this anymore. Good news: the separation between /dev/urandom and /dev/random is practically gone.

There are a few things about /dev/urandom and /dev/random that are repeated again and again. Still they are false.

I’m mostly talking about reasonably recent Linux systems, not other UNIX-like systems.

/dev/urandom is insecure. Always use /dev/random for cryptographic purposes.

Fact: /dev/urandom is the preferred source of cryptographic randomness on UNIX-like systems.

/dev/urandom is a pseudo random number generator, a PRNG, while /dev/random is a “true” random number generator.

Fact: Both /dev/urandom and /dev/random are using the exact same CSPRNG (a cryptographically secure pseudorandom number generator). They only differ in very few ways that have nothing to do with “true” randomness.

/dev/random is unambiguously the better choice for cryptography. Even if /dev/urandom were comparably secure, there’s no reason to choose the latter.

Fact: /dev/random has a very nasty problem: it blocks.

... continue reading