Module day14

Source
Expand description

ยงOne-Time Pad

Brute force slog through all possible keys, parallelized as much as possible. An optimization for part two is a quick method to convert u32 to 8 ASCII digits.

Structsยง

Exclusive ๐Ÿ”’
Regular data structures need to be protected by a mutex.
Shared ๐Ÿ”’
Atomics can be safely shared between threads.

Functionsยง

check ๐Ÿ”’
Check for sequences of 3 or 5 consecutive matching digits.
format_string ๐Ÿ”’
Write the salt and integer index as ASCII characters.
generate_pad ๐Ÿ”’
Find the first 64 keys that sastify the rules.
parse
part1
Hash each key once.
part2
Hash each key an additional 2016 times.
to_ascii ๐Ÿ”’
Quickly convert a u32 to an array of 8 ASCII values.
worker ๐Ÿ”’