[docs] [issue15213] _PyOS_URandom documentation

STINNER Victor report at bugs.python.org
Wed Aug 1 20:03:57 CEST 2012


STINNER Victor added the comment:

> The comment needs to be fixed before the issue is closed.

Ah yes, here is a patch updating the comment of _PyOS_URandom() and
the doc of the os module.

----------
keywords: +patch
Added file: http://bugs.python.org/file26650/urandom_doc.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15213>
_______________________________________
-------------- next part --------------
diff -r 2dd1b056d663 Doc/library/os.rst
--- a/Doc/library/os.rst	Wed Aug 01 14:53:22 2012 +0200
+++ b/Doc/library/os.rst	Wed Aug 01 15:34:07 2012 +0200
@@ -3331,5 +3331,5 @@ Miscellaneous Functions
    This function returns random bytes from an OS-specific randomness source.  The
    returned data should be unpredictable enough for cryptographic applications,
    though its exact quality depends on the OS implementation.  On a Unix-like
-   system this will query /dev/urandom, and on Windows it will use CryptGenRandom.
-   If a randomness source is not found, :exc:`NotImplementedError` will be raised.
+   system this will query ``/dev/urandom``, and on Windows it will use
+   :c:func:`CryptGenRandom`.
diff -r 2dd1b056d663 Python/random.c
--- a/Python/random.c	Wed Aug 01 14:53:22 2012 +0200
+++ b/Python/random.c	Wed Aug 01 15:34:07 2012 +0200
@@ -219,8 +219,9 @@ lcg_urandom(unsigned int x0, unsigned ch
     }
 }
 
-/* Fill buffer with size pseudo-random bytes, not suitable for cryptographic
-   use, from the operating random number generator (RNG).
+/* Fill buffer with size pseudo-random bytes from the operating random number
+   generator (RNG). It is suitable for for most cryptographic purposes except
+   long living private keys for asymmetric encryption.
 
    Return 0 on success, raise an exception and return -1 on error. */
 int


More information about the docs mailing list