Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def generate_diceware_password(word_count=6):
- import random
- word_dict = {}
- passphrase = []
- with open('diceware.wordlist.andy.txt') as f:
- for line in f.readlines():
- index, word = line.strip().split('\t')
- word_dict[int(index)] = word
- for words in range(0, word_count):
- this_index = 0
- for position in range(0, 5):
- digit = random.randint(1, 6)
- this_index += digit * pow(10, position)
- passphrase.append(word_dict[this_index])
- return ' '.join(passphrase)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement