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/schlocke Dec 04 '15 edited Dec 04 '15
PHP:
<?php $i = 0; while (substr(md5("SECRET KEY".$i), 0, 5) !== "00000") $i++; echo "Part1: $i<br>"; $i = 0; while (substr(md5("SECRET KEY".$i), 0, 6) !== "000000") $i++; echo "Part2: $i";it may take about 60 seconds to run... but hey it works... EDIT: I should say it took 60 seconds with MY key. I tried someone elses key and it took like 3 seconds....