]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #18405: Improve the entropy of crypt.mksalt().
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 13 Aug 2013 23:39:14 +0000 (01:39 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 13 Aug 2013 23:39:14 +0000 (01:39 +0200)
Lib/crypt.py
Misc/NEWS

index b90c81cc40e724316007d96532521168c053cd31..49ab96e1400bebe8dbdd62ce15d6911809a247a1 100644 (file)
@@ -28,7 +28,7 @@ def mksalt(method=None):
     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
 
 
index b37bf3addec3ccd260401a0565ddbdbc3411befb..7a4491aa3a8df3b337e752c0a3fa3c5f1b0a65c6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -66,6 +66,8 @@ Core and Builtins
 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