r7.1.1:define LFDS711_MISC_PRNG_SEED

From liblfds.org
Revision as of 18:11, 16 February 2017 by Admin (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source File

└───liblfds711
    └───inc
        └───liblfds711
                lfds711_misc.h

Define

#define LFDS711_MISC_PRNG_SEED

Notes

Long story short, but liblfds contains two psuedo-random number generators, one of the is big, slow and high quality, the other is small, fast and (relatively) low quality. Every time lfds711_misc_prng_init is called, it pulls one number from the big, slow, high quality PRNG and uses it as the seed for the small, fast (relatievely) low quality PRNG.

However, this leaves still the problem of how to obtain a seed for the big, slow, high quality PRNG, given that liblfds is written to run on a bare C implementation and so had no access to entropy (i.e. the time() function).

The solution is this define, which is set to a single hard coded 64-bit hex random number, obtained from random.org, which uses a true (atmospheric noise based) random number generator. The big, slow, high quality PRNG has 1024 bits of entropy (the C standard only requiring 16 bits of entropy!), and the murmurhash3 hashing function is seeded with this value and then run sixteen times, to provide the initial 1024 bit seed.

So, should you wish, you can change this original 64-bit seed value.

See Also