From: Victor Stinner Date: Tue, 13 Aug 2013 23:39:14 +0000 (+0200) Subject: Issue #18405: Improve the entropy of crypt.mksalt(). X-Git-Tag: v3.4.0a2~229^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7f7b941fdcdfe28f3cd37e84bc5d7a298385b451;p=thirdparty%2FPython%2Fcpython.git Issue #18405: Improve the entropy of crypt.mksalt(). --- diff --git a/Lib/crypt.py b/Lib/crypt.py index b90c81cc40e7..49ab96e1400b 100644 --- a/Lib/crypt.py +++ b/Lib/crypt.py @@ -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 diff --git a/Misc/NEWS b/Misc/NEWS index b37bf3addec3..7a4491aa3a8d 100644 --- 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