2015 day 4 complete

This commit is contained in:
Tristan 2018-11-30 14:39:18 +00:00
parent a71525e418
commit 20392aaf5d
2 changed files with 15 additions and 1 deletions

14
2015/4/part1.py Normal file
View file

@ -0,0 +1,14 @@
input = "ckczppom"
import hashlib
num = 6
i = 0
while True:
i += 1
m = hashlib.md5()
m.update(str(input+str(i)).encode())
print(m.hexdigest())
if m.hexdigest()[0:num] == "0"*num:
print(i)
break

View file

@ -8,7 +8,7 @@ It's a fun challenge from [here](https://adventofcode.com).
* [1](https://adventofcode.com/2015/day/1) * *
* [2](https://adventofcode.com/2015/day/2) * *
* [3](https://adventofcode.com/2015/day/3) * *
* [4](https://adventofcode.com/2015/day/4)
* [4](https://adventofcode.com/2015/day/4) * *
* [2016](https://adventofcode.com/2016)
* [2017](https://adventofcode.com/2017)
* [2018](https://adventofcode.com/2018)