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

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


http://hg.python.org/cpython/rev/122e074c56f7
changeset:   85162:122e074c56f7
parent:      85160:de5077aca668
parent:      85161:e8a314fe248b
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Aug 14 01:40:46 2013 +0200
summary:
  (Merge 3.3) 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
@@ -28,6 +28,8 @@
 Library
 -------
 
+- Issue #18405: Improve the entropy of crypt.mksalt().
+
 - Issue #12015: The tempfile module now uses a suffix of 8 random characters
   instead of 6, to reduce the risk of filename collision. The entropy was
   reduced when uppercase letters were removed from the charset used to generate

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


More information about the Python-checkins mailing list