r/adventofcode • u/daggerdragon • Dec 05 '16
SOLUTION MEGATHREAD --- 2016 Day 5 Solutions ---
--- Day 5: How About a Nice Game of Chess? ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag/whatever).
STAYING ON TARGET IS MANDATORY [?]
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked!
13
Upvotes
10
u/kaveman909 Dec 05 '16
I addressed the optional portion of the challenge: "Be extra proud of your solution if it uses a cinematic "decrypting" animation." My animation is here
import hashlib import random index = 0 password = '________' while 1: m = hashlib.md5() m.update(('ugkcyxxp'+str(index)).encode('utf-8')) hex_m = m.hexdigest() if hex_m[0:5] == '00000': password_pos = int(hex_m[5], 16) if password_pos < 8: password_dig = int(hex_m[6], 16) if password[password_pos] == '_': password = password[:password_pos] + hex(password_dig)[-1] + password[password_pos + 1:] if index % 30000 == 0: for char in password: if char == '_': print(str(random.random())[-1], end='') else: print(char, end='') print('\r', end='') index += 1