Skip to content

Commit c6a2c9b

Browse files
committed
Closes #15213: update comment for _PyOS_URandom
1 parent 7d07833 commit c6a2c9b

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

Doc/library/os.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3306,8 +3306,9 @@ Miscellaneous Functions
33063306
This function returns random bytes from an OS-specific randomness source. The
33073307
returned data should be unpredictable enough for cryptographic applications,
33083308
though its exact quality depends on the OS implementation. On a Unix-like
3309-
system this will query /dev/urandom, and on Windows it will use CryptGenRandom.
3310-
If a randomness source is not found, :exc:`NotImplementedError` will be raised.
3309+
system this will query ``/dev/urandom``, and on Windows it will use
3310+
``CryptGenRandom()``. If a randomness source is not found,
3311+
:exc:`NotImplementedError` will be raised.
33113312

33123313
For an easy-to-use interface to the random number generator
33133314
provided by your platform, please see :class:`random.SystemRandom`.

Python/random.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,9 @@ lcg_urandom(unsigned int x0, unsigned char *buffer, size_t size)
224224
}
225225
}
226226

227-
/* Fill buffer with size pseudo-random bytes, not suitable for cryptographic
228-
use, from the operating random number generator (RNG).
227+
/* Fill buffer with size pseudo-random bytes from the operating system random
228+
number generator (RNG). It is suitable for for most cryptographic purposes
229+
except long living private keys for asymmetric encryption.
229230
230231
Return 0 on success, raise an exception and return -1 on error. */
231232
int

0 commit comments

Comments
 (0)