Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #aoc2016_5a.py
- import hashlib
- import itertools
- key = "uqwqemis"
- pw = ['.','.','.','.','.','.','.','.']
- '''
- for x in itertools.count(0):
- test_key = key + str(x)
- hash_key = hashlib.md5(test_key.encode('utf-8')).hexdigest()
- if hash_key[:5] == '00000':
- pw += hash_key[5]
- print(pw)
- if len(pw) >= 8:
- break
- print(pw)
- '''
- for x in itertools.count(0):
- test_key = key + str(x)
- hash_key = hashlib.md5(test_key.encode('utf-8')).hexdigest()
- if hash_key[:5] == '00000' and hash_key[5].isdigit():
- position = int(hash_key[5])
- if position < len(pw):
- if pw[position] == '.':
- pw[position] = hash_key[6]
- print(pw)
- if '.' not in pw:
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement