Is there any 128-bit pseudorandom number generator available?

I tried the Blum Blum Shub Generator, but I can't produce a 128-bit pseudo-random number. Maybe before I produce a 128-bit pseudorandom number, I need to input a 128-bit prime number which is hard to determine.

  • 1
    $\begingroup$ Many mistakes here: a) in your recent other question it is clear your need a TRNG. b) BBS generates 1 bit at a time, and can be called 128 times to generate 128 bits. c) BBS needs a composite modulus that is hard to factor, and that implies primes much bigger than 128 bit. d) 128-bit primes are easy to get; follow this link for the smallest one. $\endgroup$ – fgrieu Jul 5 '12 at 17:04
  • $\begingroup$ @fgrieu I think you can output more than one bit at a time with BBS: up to $log_2(n)$ lower-order bits where $n$ is the size of your modulus, in bits. So for a 2048-bit modulus that's 11 bits per iteration (but 8 is probably more convenient). Not that it would make much difference from a computational point of view. $\endgroup$ – Thomas Jul 5 '12 at 18:03
  • $\begingroup$ @fgrieu I think it's a bit misleading to say he needs a true RNG. He needs a well seeded secure PRNG. $\endgroup$ – CodesInChaos Jul 5 '12 at 18:50
  • 1
    $\begingroup$ @Thomas: any source for that? The HAC, note 5.41, states that $j=c\lg\lg n$ bits can be used (where n is the modulus) but adds "an explicit range of values of $c$ for which the resulting generator is cryptographically secure under the intractability assumption of the integer factorization problem has not been determined". $\endgroup$ – fgrieu Jul 5 '12 at 22:50
  • $\begingroup$ @CodeInChaos: In order to seed the IV of OFB, we need not to repeat and not be influencable. A counter is fine. Being indistinguishable from random (the measure of security of a PRNG) is entirely optional. $\endgroup$ – fgrieu Jul 5 '12 at 22:54

BBS is probably the wrong choice for you needs.

AES in counter (CTR) mode will take a 128-bit key and produce 128-bits of output per iteration.

It also happens to be a lot faster than BBS.


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.