Of the use of unpredictableSeed

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Fri Mar 24 11:56:13 PDT 2017


On Tue, Mar 21, 2017 at 10:11:44PM +0000, sarn via Digitalmars-d wrote:
> On Tuesday, 21 March 2017 at 10:27:27 UTC, Andrei Alexandrescu wrote:
> > Thanks Yuxuan, sorry for missing this. Can we have this peer
> > reviewed by 1-2 crypto experts? Thanks! -- Andrei
> 
> By API, unpredictableSeed() only returns a 32b uint and will never
> meet crypto standards.  Beware of anyone who offers to review it based
> on their "crypto expertise".
> 
> unpredictableSeed() is just for things like making single-player games
> more interesting.  It simply isn't for security, and that's pretty
> much what cym13's post was about.

Yeah, why is it that people still keep thinking unpredictableSeed(), or
indeed, the whole of the current std.random, is useful for *anything*
related to crypto??

If you want to do crypto, you should be using a crypto library that is
*designed* to be cryptographically secure and *verified* by
cryptoanalysts to be secure.  std.random is a far cry from that, and
crypto isn't even its charter anyway.

What std.random is useful for is to make games more interesting, or for
certain kinds of Monte Carlo simulations. (Note that some Monte Carlo
simulations may be sensitive to hidden patterns in std.random PRNGs, so
you should choose your PRNG carefully, and/or take the simulation
results with a grain of salt.) Or for things like probabilistic
algorithms (e.g., probabilistic approximate solution finders for
NP-complete problems and the like).

Using it for anything crypto- or security-related is just begging to be
hacked, esp. in this day and age.


T

-- 
Why waste time learning, when ignorance is instantaneous? -- Hobbes, from Calvin & Hobbes


More information about the Digitalmars-d mailing list