From 1e1e2d1ff7debb3941a8841c4ec501dbd6edd1fd Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 23 Oct 2013 16:41:09 -0400 Subject: [PATCH] grand: Document this is not for cryptographic purposes While this is obvious to seasoned experts upon inspection, it is really worth documenting explicitly. https://bugzilla.gnome.org/show_bug.cgi?id=710736 --- glib/grand.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/glib/grand.c b/glib/grand.c index 1485c2e..9b2c0f8 100644 --- a/glib/grand.c +++ b/glib/grand.c @@ -65,10 +65,22 @@ * @short_description: pseudo-random number generator * * The following functions allow you to use a portable, fast and good - * pseudo-random number generator (PRNG). It uses the Mersenne Twister - * PRNG, which was originally developed by Makoto Matsumoto and Takuji - * Nishimura. Further information can be found at - * + * pseudo-random number generator (PRNG). + * + * Do not use this API for cryptographic purposes such as key + * generation, nonces, salts or one-time pads. + * + * This PRNG is suitable for non-cryptographic use such as in games + * (shuffling a card deck, generating levels), generating data for a + * test suite, etc. If you need random data for cryptographic + * purposes, it is recommended to use platform-specific APIs such as + * /dev/random on Unix, or CryptGenRandom() on + * Windows. + * + * GRand uses the Mersenne Twister PRNG, which was originally + * developed by Makoto Matsumoto and Takuji Nishimura. Further + * information can be found at * http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html. * * If you just need a random number, you simply call the -- 2.7.4