Search code examples
linuxrandomentropy

How random is urandom?


In Linux, just how random is /dev/urandom/? Is it considered safe?

Also is it possible to get a stream of 1's?


Solution

  • Note 4.5 years later: this is bad advice. See one of these links for details.

    If you're generating cryptographic keys on Linux, you want /dev/random, even if it blocks-- you don't need that many bits.

    For just about anything else, like generating random test data or unpredictable session IDs, /dev/urandom is fine. There are enough sources of entropy in most systems (timing of keyboard and mouse events, network packets, etc) that the output will be unpredictable.