Skip to content

Commit 7f7b941

Browse files
committed
Issue #18405: Improve the entropy of crypt.mksalt().
1 parent 4bfa6c5 commit 7f7b941

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎Lib/crypt.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def mksalt(method=None):
2828
if method is None:
2929
method = methods[0]
3030
s = '${}$'.format(method.ident) if method.ident else ''
31-
s += ''.join(_sr.sample(_saltchars, method.salt_chars))
31+
s += ''.join(_sr.choice(_saltchars) for char in range(method.salt_chars))
3232
return s
3333

3434

‎Misc/NEWS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ Core and Builtins
6666
Library
6767
-------
6868

69+
- Issue #18405: Improve the entropy of crypt.mksalt().
70+
6971
- Issue #18676: Change 'positive' to 'non-negative' in queue.py put and get
7072
docstrings and ValueError messages. Patch by Zhongyue Luo
7173

0 commit comments

Comments
 (0)