7.7
4 Day 4
The puzzle. Our input is a string of eight characters that represents part of a key for making an MD5 hash.
4.1 What is the lowest-numbered MD5 hash starting with five zeroes?
We’re asked to create an MD5 hash from an input key that consists of our eight-character input joined to a decimal number. The puzzle asks us to find the lowest decimal number that, when joined to our input, produces an MD5 hash that starts with five zeroes.
Whether or not you already know what an MD5 hash is, you can search the Racket docs and will soon find the openssl/md5 module and the md5 function. Then, this puzzle is easy: starting at 0, make new input keys with each integer, and stop when we find one that results in the MD5 hash we want. (The approach is similar to the second part of Day 1.)
4.2 How about six zeroes?
Exactly the same, except we test for a string of six zeroes. It is likely, however, to take quite a bit longer to run, as the sixth zero essentially makes the criterion 10 times more stringent.
4.3 Testing Day 4