From 7f7b941fdcdfe28f3cd37e84bc5d7a298385b451 Mon Sep 17 00:00:00 2001
From: Victor Stinner <victor.stinner@gmail.com>
Date: Wed, 14 Aug 2013 01:39:14 +0200
Subject: Issue #18405: Improve the entropy of crypt.mksalt().

---
 Lib/crypt.py | 2 +-
 Misc/NEWS    | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/Lib/crypt.py b/Lib/crypt.py
index b90c81c..49ab96e 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 b37bf3a..7a4491a 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
 
-- 
cgit v0.12