2018-03-15 16:24:23 +00:00
|
|
|
|
Advent of Code
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
|
|
|
|
--- Day 4: The Ideal Stocking Stuffer ---
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
Santa needs help mining some AdventCoins (very similar to bitcoins) to use
|
|
|
|
|
as gifts for all the economically forward-thinking little girls and boys.
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
To do this, he needs to find MD5 hashes which, in hexadecimal, start with at
|
|
|
|
|
least five zeroes. The input to the MD5 hash is some secret key (your puzzle
|
|
|
|
|
input, given below) followed by a number in decimal. To mine AdventCoins,
|
|
|
|
|
you must find Santa the lowest positive number (no leading zeroes: 1, 2, 3,
|
|
|
|
|
...) that produces such a hash.
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
|
|
|
|
For example:
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
• If your secret key is abcdef, the answer is 609043, because the MD5 hash
|
|
|
|
|
of abcdef609043 starts with five zeroes (000001dbbfa...), and it is the
|
|
|
|
|
lowest such number to do so.
|
|
|
|
|
|
|
|
|
|
• If your secret key is pqrstuv, the lowest number it combines with to
|
|
|
|
|
make an MD5 hash starting with five zeroes is 1048970; that is, the MD5
|
|
|
|
|
hash of pqrstuv1048970 looks like 000006136ef....
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
|
|
|
|
Your puzzle answer was 282749.
|
|
|
|
|
|
|
|
|
|
--- Part Two ---
|
|
|
|
|
|
|
|
|
|
Now find one that starts with six zeroes.
|
|
|
|
|
|
|
|
|
|
Your puzzle answer was 9962624.
|
|
|
|
|
|
|
|
|
|
Both parts of this puzzle are complete! They provide two gold stars: **
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
At this point, you should return to your advent calendar and try another
|
|
|
|
|
puzzle.
|
2016-12-16 22:21:15 +00:00
|
|
|
|
|
|
|
|
|
Your puzzle input was yzbqklnj.
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
|
|
|
|
|
Visible links
|
|
|
|
|
. http://adventofcode.com/
|
|
|
|
|
. http://adventofcode.com/about
|
|
|
|
|
. http://adventofcode.com/stats
|
|
|
|
|
. http://adventofcode.com/leaderboard
|
|
|
|
|
. http://adventofcode.com/settings
|
|
|
|
|
. http://adventofcode.com/auth/logout
|
|
|
|
|
. https://en.wikipedia.org/wiki/Bitcoin#Mining
|
|
|
|
|
. https://en.wikipedia.org/wiki/Bitcoin
|
|
|
|
|
. https://en.wikipedia.org/wiki/MD5
|
|
|
|
|
. https://en.wikipedia.org/wiki/Hexadecimal
|
|
|
|
|
. http://adventofcode.com/
|