Update xkcd_password.py
authorRahul Goswami <redacted>
Wed, 28 Feb 2018 19:42:26 +0000 (19:42 +0000)
committerGitHub <redacted>
Wed, 28 Feb 2018 19:42:26 +0000 (19:42 +0000)
xkcdpass/xkcd_password.py

index 81b0b26596c014b4a7c07dec081859a9c0e8532a..aee83194280a586cc0c0d6e31d69c1263106c5f7 100755 (executable)
@@ -122,7 +122,7 @@ def generate_wordlist(wordfile=None,
         max_length = min_length
     wordfile = locate_wordfile(wordfile)
 
-    words = []
+    words = set()
 
     regexp = re.compile("^{0}{{{1},{2}}}$".format(valid_chars,
                                                   min_length,
@@ -132,9 +132,9 @@ def generate_wordlist(wordfile=None,
         for line in wlf:
             thisword = line.strip()
             if regexp.match(thisword) is not None:
-                words.append(thisword)
+                words.add(thisword)
 
-    return list(set(words))  # deduplicate, just in case
+    return list(words)  # deduplicate, just in case
 
 
 def wordlist_to_worddict(wordlist):
git clone https://git.99rst.org/PROJECT