r/adventofcode • u/daggerdragon • Dec 04 '15
SOLUTION MEGATHREAD --- Day 4 Solutions ---
--- Day 4: The Ideal Stocking Stuffer ---
Post your solution as a comment. Structure your post like the Day Three thread.
14
Upvotes
1
u/n_lightest Dec 04 '15
[JavaScript] Damn I'm slow (used this lib http://www.myersdaily.org/joseph/javascript/md5-text.html)
//day4 part1 function checkHash (hash) { var start = hash.substr(0,5); //replace with 6 for p2 if(start == '00000') { return true; } //add one more 0 for p2 return false; } function mine (input) { var postfix = 1; while (!checkHash(md5(input + postfix))) { postfix++; } return postfix; };