D-Programming-Language/phobos — pull request #2208 by Abscissa (2014-05-27 22:26:21+00:00)
Title: Add SystemEntropy and HashDRBG generators.

(This is a fixed and updated version of #2206)

Adds two RNG's suitable for cryptographic purposes.

Unlike the algorithms of Phobos's existing PRNGs, the core nature of both the system RNGs and the general Hash_DRBG algorithm is to generate an arbitrary (user-specified) number of bytes at each request. That leads to this PR's notion of RNG "streams", which the SystemEntropy and HashDRBG ranges are built upon. Since the new redesigned std.stream isn't ready, the docs in this PR specifically note that these optional "stream" interfaces are subject to change. However, I'm not entirely opposed to simply making them private for the time being, if that's deemed more appropriate.

Joseph Rushton Wakeling and I have discussed at length various aspects of this (and future directions of std.random, FWIW) in this NG thread: http://forum.dlang.org/thread/lk476f$159d$1@digitalmars.com