dd + /dev/urandom

Tony Nelson tonynelson at georgeanelson.com
Fri Aug 19 01:31:09 UTC 2005


At 6:01 PM +0100 8/18/05, T. Horsnell wrote:
>OK guys, what going on here?
>Why is the length of dd's output file truncated if the job is
>paused and backgrounded? The problem is reproducible but the
>truncated lengths differ. It doesnt happen for if=/dev/zero

I don't understand either.  According to man urandom, /dev/random is
supposed to stop outputting bits when its entropy pool is exhausted, but
/dev/urandom is supposed to just keep outputting non-randomly after it runs
out of entropy.

The intended use of /dev/random is to seed some sort of pseudo-random
number generator (or some secure prng for crypto).  Normally one would only
read as few bits as one needs, or the next thing that looks there might not
find much randomness left.


>Cheers,
>Terry.
>
>
>
>[root at fmtest]# uname -a
>Linux fmtest.lmb.internal 2.6.11-1.35_FC3 #1 Mon Jun 13 00:52:08 EDT 2005
>i686 i686 i386 GNU/Linux
>
>[root at fmtest]# dd if=/dev/urandom of=junk100M.uran bs=1000000 count=100
>100+0 records in
>100+0 records out
>[root at fmtest]# ls -l junk100M.uran
>-rw-r--r--  1 root root 100000000 Aug 18 17:54 junk100M.uran
>
>
>
>[root at fmtest]# dd if=/dev/urandom of=junk100M.uran bs=1000000 count=100 &
>[1] 4516
>[root at fmtest]# 100+0 records in
>100+0 records out
>
>[1]    Done                          dd if=/dev/urandom of=junk100M.uran
>bs=1000000 count=100
>[root at fmtest]# ls -l junk100M.uran
>-rw-r--r--  1 root root 100000000 Aug 18 17:54 junk100M.uran
>
>
>
>
>[root at fmtest]# dd if=/dev/urandom of=junk100M.uran bs=1000000 count=100
>
>Suspended
>[root at fmtest]# bg
>[1]    dd if=/dev/urandom of=junk100M.uran bs=1000000 count=100 &
>[root at fmtest]# 99+1 records in
>99+1 records out
>
>[1]    Done                          dd if=/dev/urandom of=junk100M.uran
>bs=1000000 count=100
>[root at fmtest]# ls -l junk100M.uran
>-rw-r--r--  1 root root 99506220 Aug 18 17:55 junk100M.uran
____________________________________________________________________
TonyN.:'                       <mailto:tonynelson at georgeanelson.com>
      '                              <http://www.georgeanelson.com/>




More information about the fedora-list mailing list