On the Subject of the Inverted Maroon Cipher

I bet you will feel like a maroon trying to tackle this cipher.

 A 2 00000 00 00001 01 00010 10 00011 11 00100 0 00101 1 00110 00111 01000 01001 01010 01011 01100 01101 01110 01111 10000 10001 10010 10011 1010 1011 1100 1101 1110 1111

On the module, you will see 3 screens, a keyboard, 2 buttons with a letter on it, and a submit button that displays the current page you're on.

Pressing the right arrow takes you to the next page. Pressing the left arrow takes you to the previous page. There is a total of 2 pages.

On page 1, the top screen shows a 6 letter encrypted word, the middle screen shows a keyword, and the bottom screen shows a number key.

On page 2, the top, middle, and bottom screens displays a random amount of characters.

Step 1: Modified Huffman Cipher

Start by creating an alphabet key by using the keyword on the middle screen on page 1.

Remove any duplicate letters from the keyword (keep each letter’s first occurrence). Take the entire alphabet and remove any letters that are in the keyword.

If the number of ports modulo 4 is 0 or 1, place the alphabet at the end of the keyword. Otherwise, place the alphabet at the beginning of the keyword. This is the alphabet key.

Concatenate the encrypted word and the top screen on page 2 in that order. Convert this encoded string to binary by replacing each character with a binary code from the table on the right.

For each bit of the binary string, do the following:

• 1: Create an number node. If you have more than 1 number node, find the most recently created number node before this node that doesn't contain 2 characters and put in the number node you just created into that number node.
• 0: Put in the left most letter from the alphabet key inside the node that was created most recently that doesn't contain 2 characters. Remove that letter from the alphabet key.

Example

Encrypted Word: ZKOGQZ
Alphabet Key: ABCGHIJKLMPQSTUVWXYZOFENDR
Top Screen: IYWME
Binary String: 111101010011100011010000111101000111011000110000100

01, 12910, P1819, 22
12, Q10K, 1119W, 20
23, 611L, M2021, Z
3A, 41213, 2421X, Y
4B, 51314, 172223, E
5C, G1415, V23O, F
67, 915S, 1624D, R
78, J16T, U
8H, I1718, N

Start at the first created number node. This will be called the root from now on.

Concatenate the middle and bottom screens on page 2 in that order. For each character do the following:

• Letter: From the root, record the path needed to get to that letter in the Huffman Table. For each left, write down a 0. For each right, write down a 1.
• Number: Convert it into binary using the binary table on the previous page.

Convert the binary back in to letters using the binary table on the previous page. The resulting letters will become your new 6 letter encrypted word.

Example

Middle/Bottom Screen: CDSQ VRR7

C -> 000110
D -> 110
S -> 10000
Q -> 01
V -> 1001
R -> 111
R -> 111
7 -> 1

Binary: 000110110100000110011111111

00011 -> D
01101 -> N
00000 -> A
1100 -> W
1111 -> Z
1111 -> Z

New Encrypted Word: DNAWZZ

Step 2: Redfence Transposition

For this, you will need the encrypted word you got from step 1 and the number key from the bottom screen of page 1.

Place down the letters in a zig zag pattern with the number of rows equal to the length of the number key:

Example

Encrypted Word: DNAWZZ
Key: 132
1:   D       Z
2:     N   W   Z
3:        A

Finally, read the letters in the order of the key number. You should now have a new encrypted word.

Example

Key: 132
1:   D       Z
2:     N   W   Z
3:        A
New Encrypted Word: DZANWZ

Step 3: Monoalphabetic Cipher

For this, you're going to need the encrypted word from step 2 and the alphabet key from step 1.

Write down the alphabet above the alphabet key.

For each letter of the encrypted word, find the letter in the top row and replace it with the letter directly below it.

The resulting letters will be your decrypted word.

Example

Encrypted Word: DZANWZ

ABCDEFGHIJKLMNOPQRSTUVWXYZ
ABCGHIJKLMPQSTUVWXYZOFENDR

DZANWZ -> GRATER

Decrypted Word: GRATER

Once you finally have your decrypted word, you can submit it. Once you start typing, all the screens will go black and the bottom screen will show what you are typing.

To clear it, just click one of the arrows. This goes to one of the pages and clears any input you put in. It will not let you go over 6 letters on input.

Once you are satisfied with your input, press the button labeled "SUB" to submit your answer. On a strike, the module will go back to the first page of the module, but it does not regenerate.