I am in need of a really simple limited PRNG, that either exists or can easily be created in virtually any language on any platform. It takes only the initial seed, and is only expected to generate a small amount of output in its lifetime, normally 32-64 bytes but potentially more with very low probability. It will not reseed. There is precisely one consumer of its output - an ECDH key generator. If given the same initial seed on different languages or platforms, the PRNG must generate the same exact output. (Hence, given the same initial seed on different languages or platforms, it is possible to determinstically recreate the same ECDH keypair.)

The requirement for cross-platform consistency and no need for reseeding are driving me to seek a well known standard implementation of some standard PRNG. It will not be Yarrow or Fortuna because they obviously don't fit the requirements.

Does there exist some well known PRNG that fits this description?

Note: I removed "My Simple Limited PRNG" as it is no longer relevant. Because the answer to the first question "Does something like this already exist, that is well known" is yes.

  • $\begingroup$ Yes, there are at least 5 such PRNGs. $\;$ $\endgroup$
    – user991
    Nov 19 '14 at 21:34
  • $\begingroup$ Not a direct answer but for my cuckoo byte stuffing algorithm I researched and found a very small PRNG that passes the diehard tests and has had academic review but takes only a few dozen bytes of code on an 8 bit MCU. Producing arch independent output was a vital requirement as well. You can pull just the 'next_ecode' routine out of the code, it is based on the well known xorshift set of algorithms. notanumber.net/archives/183/cuckoo-byte-stuffing-algorithm The code and algorithms are public domain. If you want more state, use one from en.wikipedia.org/wiki/Xorshift $\endgroup$ Nov 19 '14 at 22:33
  • $\begingroup$ @RickyDemer This comment is actually extremely helpful, because it's all defined in section 10 of 800-90A. This, I can definitely work with. Thanks. If you want to post this as an answer, I think you deserve the credit. $\endgroup$ Nov 19 '14 at 22:34

Yes. This paper on nist.gov gives five such PRNGs.
Three of them are based on hash functions and two of them are based on block ciphers.

  • $\begingroup$ Thanks - They are talking about HMAC-DRBG, KHF-DRBG, and Hash-DRBG, which are defined in section 10 of 800-90A. This, I can definitely work with. Thanks. $\endgroup$ Nov 20 '14 at 12:06

This looks like one. It does say "non-cryptographic" so I assume it is repeatable given the same seed. A small noncryptographic PRNG. You could also do a an implementation of a Message Authentication Code (MAC) such as this one UMAC which says it is meant to be "well supported on contemporary machines".

  • 2
    $\begingroup$ A PRNG is always repeatable given the same seed, whether or not it is cryptographic. What cryptographic means that if you don't know the seed, the output is indistinguishable from random (even if you are given the rest of the details of how the PRNG works) $\endgroup$
    – poncho
    Nov 20 '14 at 5:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.