Advent of Code: Day 4
The Ideal Stocking Stuffer

First puzzle

Here the puzzle is to find a number that will generate an MD5 hash with five zeroes if added to a “secret key.” The “secret key” is the puzzle input. The examples are shown in the description are:

This time, I didn’t try to find the “immutable” solution, and I use a var on the function to calculate the number. In addition to that, it is very straightforward counting on MD5 Java implementation:

Second puzzle

The second part is doing the same, but finding the number to have six zeroes on the hash:

You can find this code along with my input and puzzle answers at here.

*****
Written by Darien Martinez Torres on 04 March 2016