Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fc8a0a7

Browse files
committed
(Merge 3.3) Issue #18405: Improve the entropy of crypt.mksalt().
2 parents 9786910 + 7f7b941 commit fc8a0a7

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
@@ -28,6 +28,8 @@ Core and Builtins
2828
Library
2929
-------
3030

31+
- Issue #18405: Improve the entropy of crypt.mksalt().
32+
3133
- Issue #12015: The tempfile module now uses a suffix of 8 random characters
3234
instead of 6, to reduce the risk of filename collision. The entropy was
3335
reduced when uppercase letters were removed from the charset used to generate

0 commit comments

Comments
 (0)