Messages in this thread | | | Subject | Re: Wanted: Secure-delete utility for Linux | Date | Wed, 23 Dec 1998 00:09:24 -0400 | From | Horst von Brand <> |
| |
thomasz@hostmaster.org said:
> Unfortunately the current /dev/random and /dev/urandom are very slow in > generating data. Therefore I would rather like a /dev/frandom for fast, > low quality randomness.
Write a tiny program for the task, something like:
#include <stdio.h> #include <stdlib.h> #include <time.h>
main() { unsigned long x; /* I'm assuming 32 bits here */ x = time(NULL);
for(;;) { x = 69069 * x + 1; fwrite(&x, sizeof(x), 1, stdout); } exit(EXIT_SUCCESS); }
(The 69069 is _not_ random here; check Knuth's "The Art of Computer Programming", vol2 for theory and explanation).
There are faster methods, but I'd guess that the I/O time swamps everything else. Perhaps fiddling with using putc_unlocked(3) to avoid other overheads might be warranted...
Hope this helps. -- Horst von Brand vonbrand@sleipnir.valparaiso.cl Casilla 9G, Viña del Mar, Chile +56 32 672616
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |