[clug-talk] Random numbers in Linux: an example

Eric Mei ericm at clusterfs.com
Thu Sep 8 10:49:41 PDT 2005


Mark Lane wrote:

>> At your shell, type in the command: od -t x1 /dev/random
>>
>> od -t x1 /dev/urandom
>>
> The reason you need to move mouse is because /dev/random is based on 
> entropy generated from i/o (such as mouse and keyboard input) and the 
> more i/o generated the more random the numbers. The Linux kernel by 
> default doesn't use network traffic for generating entrophy so often 
> headless systems like network servers and clusters will either have to 
> add a hardware random number generator or recompile the kernel if they 
> require good random numbers.


Also note "/dev/random" is the real entropy generated by hardware event 
within the system, which might be quickly used out,  while /dev/urandom 
also use the hardware random, once used out, it will switch to software 
random number generation algorithm, of course it's not _real_ random. So 
the "od /dev/random" might stall there (waiting for more random 
generated) but never stall on  /dev/urandom.

Eric



More information about the clug-talk mailing list