## On the Subject of The Inverted Gray Cipher

This cipher might seem gray and bleak and boring. Well, I must say... you're not wrong.

On the module, you will see 3 screens, a keyboard, 2 arrows, 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 1 page.

On page 1, the top screen shows a 6 letter encrypted word, the middle screen shows a word, the bottom screen shows a 6 digit binary string.

### Step 1: Portax Cipher

For this, you're going to need the encrypted word from the top screen of page 1 and the 3 letter key on the top screen of page 2.

You will also need this cipher table that consists of 4 rows of letters, divided into 2 subgroups of 2 rows:

ABCDEFGHIJKLM
NOPQRSTUVWXYZNOPQRSTUVWXY
-------------------------
ACEGIKMOQSUWYACEGIKMOQSUW
BDFHJLNPRTVXZBDFHJLNPRTVX

Split the encrypted word in half so you have 2 3 letter strings. Place the 2nd half under the 1st half. Each column is treated like a letter pair reading top to bottom. For each letter pair, do the following:

• Shift the top row so that the letter A aligns with the letter on the 3rd/4th row that is the same letter as the Nth letter of the key.
• Find the 1st letter in the pair in the 1st/2nd row that is within the length of the top row.
• Find the 2nd letter in the pair in the 3rd/4th row that is within the length of the top row.
• If the 2 letters are in the same column, the 1st letter will be replaced with the letter in the 1st/2nd row and the 2nd letter will be replaced with the letter in the 3rd/4th row.
• Otherwise, replace the 1st letter with the letter in the same row as the 1st but in the same column as the 2nd. And replace the 2nd letter with the letter in the same row as the 2nd but in the same column as the 1st.

Read the letters by taking the 1st letter in each letter pair in reading order, then the 2nd letter to get a new encrypted word.

Encrypted Word: LTNLUV
Key: NMF

LTN
LUV
ABCDEFGHIJKLM
NOPQRSTUVWXYZNOPQRSTUVWXY
ACEGIKMOQSUWYACEGIKMOQSUW
BDFHJLNPRTVXZBDFHJLNPRTVX

LL -> MJ

ABCDEFGHIJKLM
NOPQRSTUVWXYZNOPQRSTUVWXY
ACEGIKMOQSUWYACEGIKMOQSUW
BDFHJLNPRTVXZBDFHJLNPRTVX

TU -> XM

ABCDEFGHIJKLM
NOPQRSTUVWXYZNOPQRSTUVWXY
ACEGIKMOQSUWYACEGIKMOQSUW
BDFHJLNPRTVXZBDFHJLNPRTVX

NV -> XB

MXX
JMB

New Encrypted Word: MXXJMB

### Step 2: Columnar Transposition

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

Write the encrypted word underneath the number so that it fits in to columns of the numbers.

Rearrange the columns so that the numbers are in ascending order.

Finally, read the letters top to bottom, left to right to get your decrypted word.

#### Example

Encrypted Word: MXXJMB
Number: 15243

1 5 2 4 3
M X X J M
B
1 2 3 4 5
M X M J X
B

New Encrypted Word: MBXMJX

### Step 3: Bit Switch Cipher

For this, you will need the encrypted word you got from step 2, and the 6 digit binary string on the middle screen.

First determine the scrambler that will be used by using the first character of the serial number:

021453923154I24513R24531
121534A25134J25413S25431
231524B24153K34512T34521
331452C34152L35214U35421
441523D35124M35412V43251
541532E45123N43512W43521
651234F45132O45213X45231
751423G54123P53412Y53421
851432H54132Q54213Z54231

Next turn each letter of the encrypted word you have so far into a binary sequence using the table below:

A00001H01000O01111V10110
B00010I01001P10000W10111
C00011J01010Q10001X11000
D00100K01011R10010Y11001
E00101L01100S10011Z11010
F00110M01101T10100
G00111N01110U10101

For each binary sequence, if the binary bit (middle screen) at the letter's position is a 1, invert the bits. Then run it through the scrambler so that the binary bit is in the same position as the number in the same position in the scrambler.

#### Example

Scrambler: 23154
Binary: 10011
1 goes into the 2nd position -> -1---
0 goes into the 3rd position -> -10--
0 goes into the 1st position -> 010--
1 goes into the 5th position -> 010-1
1 goes into the 4th position -> 01011
10011 -> 01011

Finally turn the binary back into a letter using the same table to get your decrypted word.

#### Example

Encrypted Word: MBXMJX
Scrambler Used: 23154
Bottom Screen Binary: 000001

M -> 01101 + 0 -> 01101 + 23154 -> 10110 -> V
B -> 00010 + 0 -> 00010 + 23154 -> 00001 -> A
X -> 11000 + 0 -> 11000 + 23154 -> 01100 -> L
M -> 01101 + 0 -> 01101 + 23154 -> 10110 -> V
J -> 01010 + 0 -> 01010 + 23154 -> 00101 -> E
X -> 11000 + 1 -> 00111 + 23154 -> 10011 -> S
Decrypted Word: VALVES

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.