static void fill_pool(csprng *rng) { /* hash down output of RNG to re-fill the pool */ int i; sha sh; shs_init(&sh); for (i=0;i<128;i++) shs_process(&sh,sbrand(rng)); shs_hash(&sh,rng->pool); rng->pool_ptr=0; }
/* SU= 312 */ static void fill_pool(csprng *rng) { /* hash down output of RNG to re-fill the pool */ int i; mcl_hash256 sh; MCL_HASH256_init(&sh); for (i=0;i<128;i++) MCL_HASH256_process(&sh,sbrand(rng)); MCL_HASH256_hash(&sh,rng->pool); rng->pool_ptr=0; }
static void sirand(csprng* rng,mr_unsign32 seed) { /* initialise random number system */ /* modified so that a subsequent call "stirs" in another seed value */ /* in this way as many seed bits as desired may be used */ int i,in; mr_unsign32 t,m=1L; rng->borrow=0L; rng->rndptr=0; rng->ira[0]^=seed; for (i=1;i<NK;i++) { /* fill initialisation vector */ in=(NV*i)%NK; rng->ira[in]^=m; /* note XOR */ t=m; m=seed-m; seed=t; } for (i=0;i<10000;i++) sbrand(rng ); /* "warm-up" & stir the generator */ }