Module day21

Module day21 

Source
Expand description

§Scrambled Letters and Hash

The forward transformations are straightforward. The trickiest reverse transformation is the rotation based on the index of the letter. First we build a lookup table of how many places to rotate right based on the letter index. This is +1 for positions 0-3 and +2 for positions 4-7.

Then we invert this by mapping the transformed index to the rotation. For example position 3 is rotated right by 4 places, ending up at position 7, so the inverse lookup table to rotate left stores 4 at index 7.

Enums§

Op

Constants§

ROTATE_LETTER_LEFT 🔒
ROTATE_LETTER_RIGHT 🔒

Functions§

parse
part1
part2
scramble
unscramble