Re: Efficient pseudo-random number generation

From: Jerry Coffin (jcoffin_at_taeus.com)
Date: 04/25/04


Date: 25 Apr 2004 08:13:54 -0700


"Cy Edmunds" <cedmunds@spamless.rochester.rr.com> wrote in message news:<eZFic.93900$M3.41471@twister.nyroc.rr.com>...

[ ... ]

> rand() is OK for making a Yahtzee program, but for something as important as
> encryption I would not recommend it. The standard only requires it to
> deliver 16 bits and the requirements of its statistical performance are
> inadequately defined. Good portable generators of 31 bits or more are
> readily available -- e.g. www.boost.org

Though you don't state it directly, you more or less imply that a
31-bit generator IS suitable for encryption.

This is NOT generally the case. First of all, rand() is typically
implemented as a linear-congruential PRNG, which not suitable for
cryptographic purposes, regardless of size.

Second, if you do start with a suitable algorithm, a cryptographic
generator will generally need to store substantially more than 31 bits
of state -- somewhere in the vicinity of twice that would be a
reasonable starting point, and depending on exactly what you're doing,
the requirements might easily go up from there.

-- 
    Later,
    Jerry.
The universe is a figment of its own imagination.


Relevant Pages

  • Re: Is Fax Dead Yet?
    ... I played with some homebrew encryption ideas. ... I had a random number generator shift all the document characters. ... Glue under postage stamp, don a dark trenchcoat, hat, dark sunglasses, brisk walk to mailbox, look over shoulder, look over shoulder some more, drop the letter in, push Smith&Wesson back into holster, saunter down the road and whistle a tune. ...
    (sci.electronics.design)
  • Re: Advice on a new encryption algorithm
    ... > say false is because it is based on a Non-Random Number Generator. ... the tables always the same for every encryption. ... > Here is where I worry that all the math gurus will cut my algorithm to ... All I am doing is converting the characters of the plaintext ...
    (sci.crypt)
  • Re: Is Fax Dead Yet?
    ... When it comes to consumer electronics, 128-bit encryption is still "high end." ... I had a random number generator shift all the document characters. ... It's just noise. ... That's called a "one-time pad" and cannot be decoded (assuming the pad ...
    (sci.electronics.design)
  • Re: Is Fax Dead Yet?
    ... When it comes to consumer electronics, 128-bit encryption is still "high end." ... I had a random number generator shift all the document characters. ... It's just noise. ... That's called a "one-time pad" and cannot be decoded (assuming the pad ...
    (sci.electronics.design)