Difference between revisions of "Random number generation"
(create the page by moving content from Securely wipe disk#Kernel built-in RNG)
Revision as of 12:45, 1 October 2012
The Kernel built-in RNG /dev/random provides you the same quality random data you would use for keygeneration, but can be nearly impractical to use at least for wiping current HDD capacitys. What makes disk wiping take so long with is to wait for it to gather enough true entropy. In an entropy starved situation (e.g. remote server) this might never end while doing search operations on large directories or moving the mouse in X can slowly refill the entropy pool.
You can always compare
/proc/sys/kernel/random/poolsize to keep an eye on your entropy pool.
The Kernels poolsize is
4096 bit. (512 Byte)
While Linux kernel 2.4 did have writable
/proc-entries for controlling the entropy-poolsize in newer kernels only
write_wakeup_threshold are writable.
The pool size is now hardcoded in kernel line 275 of
/* * Configuration information */ #define INPUT_POOL_WORDS 128 #define OUTPUT_POOL_WORDS 32 #define SEC_XFER_SIZE 512 #[...]
where poolsize is
4096 = INPUT * OUTPUT
/dev/random uses the kernel entropy pool and will halt overwriting until more input entropy once this pool has been exhausted. This can make it impractical for overwriting large hard disks.
/dev/urandom in contrast will reuse entropy when low on it so you won't get stuck. Nevertheless it might still take a long time to bottle-feed the neverending surge of large drives with data.
The output may contain less entropy than the corresponding read from /dev/random. However it is still intended as a pseudorandom number generator suitable for most cryptographic purposes,
Pseudorandom number generator
There are also cryptographically secure pseudorandom number generators like Yarrow (FreeBSD/OS-X) or Fortuna (the intended successor of Yarrow).