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/703d027245e678982678 to your computer and use it in GitHub Desktop.
Save ghaiklor/703d027245e678982678 to your computer and use it in GitHub Desktop.
Advent of Code (Day 4 Part 1)
const crypto = require('crypto');
const INPUT = 'ckczppom';
const md5 = data => crypto.createHash('md5').update(data).digest('hex');
const isStartsWithFiveZeros = data => data.slice(0, 5) === '00000';
let counter = 0;
while (!isStartsWithFiveZeros(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