A few months ago the user “quirino” posted to HackerNews (HN) an interesting shallenge. Find the lowest hash SHA256 value for a string with certain format:
When this was posted, I wanted to participate, compete with other users, get my code to run as fast as possible and see if I could get lucky finding a low hash value.
In this blog post I will describe the different attempts I did to hash the fastest, how I went from 1.5 Megahashes/s to 18.8 Gigahashes/s and share my final solution.
My first attempt at this was using my CPU. To be honest I didn’t even think about using a graphics card (GPU) as I had never done that before and well, its called graphics card not hash card.
I started writing a first implementation in Go. It’s very simple, generate a random string, calculate its hash value using the crypto package, and check if its lower than the stored hash value.
Running this got me about 1.5 Megahashes/s (MHs). The longer the random string was, the lower the hash rate got. At this point I thought there wasn’t much to improve about the code since it was pretty straight forward.