Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@ghaiklor
Last active January 5, 2016 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ghaiklor/c1ce2792f76e596f6055 to your computer and use it in GitHub Desktop.
Save ghaiklor/c1ce2792f76e596f6055 to your computer and use it in GitHub Desktop.
Advent of Code (Day 4 Part 2)
const crypto = require('crypto');
const INPUT = 'ckczppom';
const md5 = data => crypto.createHash('md5').update(data).digest('hex');
const isStartsWithSixZeros = data => data.slice(0, 6) === '000000';
let counter = 0;
while (!isStartsWithSixZeros(md5(`${INPUT}${counter}`))) counter++;
console.log(counter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment