Commit 3a54f1f1 authored by Benjamin REED's avatar Benjamin REED

made dictionary work

parent 0590504d
......@@ -340,7 +340,18 @@ def generate_password(length, charset, words: bool = False):
s = []
dic = open(DICTIONARY_PATH)
lines = dic.read().split('\n') # 2 MEGABYTES by the way
for line in lines:
skipped = 0
i = random.randint(100, 3000)
while True:
if i >= len(lines):
i = random.randint(100, 3000)
line = lines[i]
if random.randint(0, 50) != 12 and skipped < 40:
skipped += 1
i = random.randint(400 + skipped, 3000 + skipped * 8000)
continue
skipped = 0
if '/' not in line: continue
word = line.split('/')[0]
if len(word) >= length: continue
if len(s) + len(word) >= length:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment