diff --git a/2015/4/part1.py b/2015/4/part1.py new file mode 100644 index 0000000..59ed54e --- /dev/null +++ b/2015/4/part1.py @@ -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 + diff --git a/README.md b/README.md index 7c9c562..b8b68d0 100644 --- a/README.md +++ b/README.md @@ -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)