Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 599
Recursion Avatar asked Dec 08 '09 18:12

Recursion


People also ask

Is Dev urandom random?

The /dev/urandom device provides a reliable source of random output, however the output will not be generated from an equal amount of random input if insufficient input is available. Reads from the /dev/urandom device always return the quantity of output requested without blocking.

How is urandom generated?

Implementation Specifics. The /dev/random and /dev/urandom devices are created from major and minor numbers assigned by the device configuration subsystem when the random number generator is loaded, so the device names should always be used when attempting to locate or open the devices.

Is Dev urandom pseudo random?

In Unix-like operating systems, /dev/random, /dev/urandom and /dev/arandom are special files that serve as pseudorandom number generators.

What is the difference between random and urandom?

'Urandom' is used where there is constant need of random numbers and its randomness is not much important while 'random' is used where there is a security concern and its randomness should be reliable as it blocks outputting random numbers if entropy is not up to the mark.


1 Answers

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.

like image 54
Eric Seppanen Avatar answered Oct 10 '22 18:10

Eric Seppanen