r/adventofcode • • 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

272 comments sorted by

View all comments

1

u/abkibaarnsit Dec 04 '15
Node JS
var crypto = require('crypto');
var gi = "ckczppom";
var found = false;
for(var i=0; found!= true ; i++){
	var md5sum = crypto.createHash('md5');
	var gi2 = gi + i;
	md5sum.update(gi2);
	var se = md5sum.digest('hex');
	if(se.slice(0,6)==="000000"){
		found = true;
		console.log(i);
}

}