#!/usr/bin/env python3

from os import path
from hashlib import md5
from itertools import count


with open(path.join(path.dirname(__file__), "input.txt")) as f:
    result = f.read().strip().encode()
    for i in count(1):
        if md5(result + str(i).encode()).hexdigest()[:5] == "00000":
            print("Part 1:", i)
            break
    for i in count(i):
        if md5(result + str(i).encode()).hexdigest()[:6] == "000000":
            print("Part 2:", i)
            break

18002db0ec513dc30814635f341e5c1a7c212d5a
<mask token>

<mask token>
with open(path.join(path.dirname(__file__), 'input.txt')) as f:
    result = f.read().strip().encode()
    for i in count(1):
        if md5(result + str(i).encode()).hexdigest()[:5] == '00000':
            print('Part 1:', i)
            break
    for i in count(i):
        if md5(result + str(i).encode()).hexdigest()[:6] == '000000':
            print('Part 2:', i)
            break

from os import path
from hashlib import md5
from itertools import count
with open(path.join(path.dirname(__file__), 'input.txt')) as f:
    result = f.read().strip().encode()
    for i in count(1):
        if md5(result + str(i).encode()).hexdigest()[:5] == '00000':
            print('Part 1:', i)
            break
    for i in count(i):
        if md5(result + str(i).encode()).hexdigest()[:6] == '000000':
            print('Part 2:', i)
            break

#!/usr/bin/env python3

from os import path
from hashlib import md5
from itertools import count


with open(path.join(path.dirname(__file__), "input.txt")) as f:
    result = f.read().strip().encode()
    for i in count(1):
        if md5(result + str(i).encode()).hexdigest()[:5] == "00000":
            print("Part 1:", i)
            break
    for i in count(i):
        if md5(result + str(i).encode()).hexdigest()[:6] == "000000":
            print("Part 2:", i)
            break
