lkml.org 
[lkml]   [1998]   [Dec]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Wanted: Secure-delete utility for Linux
Date
From
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/

\
 
 \ /
  Last update: 2005-03-22 13:46    [W:0.247 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site