Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(3311)

Unified Diff: Lib/os.py

Issue 13703: Hash collision security issue
Patch Set: Created 1 year, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
--- a/Lib/os.py Fri Jan 27 09:42:45 2012 +0100
+++ b/Lib/os.py Mon Feb 13 15:34:04 2012 -0500
@@ -742,22 +742,3 @@
_make_statvfs_result)
except NameError: # statvfs_result may not exist
pass
-
-if not _exists("urandom"):
- def urandom(n):
- """urandom(n) -> str
-
- Return a string of n random bytes suitable for cryptographic use.
-
- """
- try:
- _urandomfd = open("/dev/urandom", O_RDONLY)
- except (OSError, IOError):
- raise NotImplementedError("/dev/urandom (or equivalent) not found")
- try:
- bs = b""
- while n - len(bs) >= 1:
- bs += read(_urandomfd, n - len(bs))
- finally:
- close(_urandomfd)
- return bs
« no previous file with comments | « Include/pythonrun.h ('k') | Lib/test/test_cmd_line.py » ('j') | Lib/test/test_cmd_line.py » ('J')

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7