[Python-checkins] cpython (3.3): Issue #18405: Improve the entropy of crypt.mksalt().

victor.stinner python-checkins at python.org
Wed Aug 14 01:40:58 CEST 2013


http://hg.python.org/cpython/rev/e8a314fe248b
changeset:   85161:e8a314fe248b
branch:      3.3
parent:      85155:49fa63610c7f
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Aug 14 01:39:14 2013 +0200
summary:
  Issue #18405: Improve the entropy of crypt.mksalt().

files:
  Lib/crypt.py |  2 +-
  Misc/NEWS    |  2 ++
  2 files changed, 3 insertions(+), 1 deletions(-)


diff --git a/Lib/crypt.py b/Lib/crypt.py
--- a/Lib/crypt.py
+++ b/Lib/crypt.py
@@ -28,7 +28,7 @@
     if method is None:
         method = methods[0]
     s = '${}$'.format(method.ident) if method.ident else ''
-    s += ''.join(_sr.sample(_saltchars, method.salt_chars))
+    s += ''.join(_sr.choice(_saltchars) for char in range(method.salt_chars))
     return s
 
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -66,6 +66,8 @@
 Library
 -------
 
+- Issue #18405: Improve the entropy of crypt.mksalt().
+
 - Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get
   docstrings and ValueError messages. Patch by Zhongyue Luo
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list