Talk About Network

Google





Science > Crypt Random-numbers > Uninitialized R...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 13 Topic 400 of 428
Post > Topic >>

Uninitialized RAM as a PRNG seed

by ross <ross@[EMAIL PROTECTED] > Jan 1, 2008 at 08:44 PM

When a chunk of memory is newly allocated it is filled with data from 
whatever program last used it.  Is there anything wrong with using that 
to initialize a PRNG?

(Unless your runtime lib "helpfully" clears new allocations for you, of 
course.  Then you might as well just use 0 for a PRNG seed.)

Something like the following.

/*begin C-like pseudo code*/

time_t t;
size_t s;
unsigned char *m;
sha512context hash;

t = time(NULL); /* Example only.  Use something more granular. */
while(t == time(NULL));
s = (size_t)t;
s %= 524288;
s += 524288;
m = (unsigned char *)malloc(s);

sha512_init(&hash);
sha512_update(&hash, m, s);
sha512_update(&hash, t, sizeof(time_t));
sha512_final(&hash);

free(m);

initialize_prng_with_array(hash.digest, 512 / 8);

/*end C-like pseudo code*/

The system time or some other guaranteed-unique value is necessary for 
two reasons: (1) to ensure a different PRNG seed on every run, and (2) so 
another prog can't control the PRNG seed by "initializing" memory before 
we allocate it.
 




 13 Posts in Topic:
Uninitialized RAM as a PRNG seed
ross <ross@[EMAIL PROT  2008-01-01 20:44:18 
Re: Uninitialized RAM as a PRNG seed
daw@[EMAIL PROTECTED] (D  2008-01-01 20:50:39 
Re: Uninitialized RAM as a PRNG seed
"Sebastian G."   2008-01-01 22:03:16 
Re: Uninitialized RAM as a PRNG seed
daw@[EMAIL PROTECTED] (D  2008-01-01 21:10:03 
Re: Uninitialized RAM as a PRNG seed
Ari <arisilverstein@[E  2008-01-03 16:50:48 
Re: Uninitialized RAM as a PRNG seed
"Sebastian G."   2008-01-03 23:11:58 
Re: Uninitialized RAM as a PRNG seed
Ari <arisilverstein@[E  2008-01-05 04:41:49 
Re: Uninitialized RAM as a PRNG seed
"Sebastian G."   2008-01-05 11:52:40 
Re: Uninitialized RAM as a PRNG seed
Ivan Voras <ivoras@[EM  2008-01-02 00:04:35 
Re: Uninitialized RAM as a PRNG seed
"Sebastian G."   2008-01-01 22:02:12 
Re: Uninitialized RAM as a PRNG seed
"John E. Hadstate&qu  2008-01-01 16:17:41 
Re: Uninitialized RAM as a PRNG seed
hbdere <hbdere@[EMAIL   2008-01-02 08:35:21 
Re: Uninitialized RAM as a PRNG seed
Vend <vend82@[EMAIL PR  2008-01-02 08:38:43 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Thu Jan 8 0:10:50 PST 2009.