## On the Subject of the Magenta Cipher

The color magenta doesn't exist, it is your brain trying to make sense of your red and blue cones activating while the green is inactive. This cipher is merely a pigment of your imagination.

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 any of the arrows will only clear any letters that you have pressed since there is only 1 page for this cipher.

The top screen shows a 6 letter encrypted word, the middle screen displays a number, and the bottom screen shows a 3 letter key.

Follow the mechanics down below to decrypt your word:

### Step 1: Affine Cipher

The encrypted word can be decrypted using this formula: ((C - X) * D) % 26

X is calculated by taking the sum of the serial number digits, modulo 25, plus 1. D is the multiplicative inverse of the number displayed on the middle screen (This is called E). D can be found by satisfying this equation: (E * D) % 26 = 1

For each letter, turn it into a number using their alphabetic positions, plug it into the variable C in the equation, and turn the resulting value back into a letter. Note: Z can be both 0 and 26.

You should now have a new encrypted word.

#### Example

Encrypted Word: WVQMOG
Middle Screen: 9 -> (9 * 3) % 26 = 1
X: ((7 + 3) % 25) + 1 = 11

W -> ((23 - 11) * 3) % 26 -> 10 -> J
V -> ((22 - 11) * 3) % 26 -> 7 -> G
Q -> ((17 - 11) * 3) % 26 -> 18 -> R
M -> ((13 - 11) * 3) % 26 -> 6 -> F
O -> ((15 - 11) * 3) % 26 -> 12 -> L
G -> ((07 - 11) * 3) % 26 -> 14 -> N

New Encrypted Word: JGRFLN

### Step 2: Myszkowski Transposition

Create a key by taking the letters in the serial number and assign each letter in alphabetical order, ties included, where 1 is a letter that occurs earliest from the alphabet.

Next, place 6 dashes underneath the key so that it fits in the columns of the key in reading order.

Place each letter of the encrypted word you got from step 1 in ascending numerical order, replacing each dash underneath the number. In the case of duplicate numbers in the key, place them from left to right, top to bottom for the current duplicate number, until each of the dashes underneath the duplicate numbers been replaced. Then read the letters in reading order to get a new encrypted word.

#### Example

Encrypted Word: JGRFLN
Letters: LPWP

 L P W P 1 2 3 2 - - - - - -
 L P W P 1 2 3 2 J R N F G L

New Encrypted Word: JRNFGL

### Step 3: Autokey Cipher

For this, you will need the encrypted word you got from step 2 and the key from the bottom screen.

Take the first letter of your encrypted word and the first letter of the key and turn them into numbers using their alphabetic positions.

Now take the first number minus the second number, and then turn the new number back into a letter treating as its alphabetic position.

If the resulting number is 0 or below, add 26 until the number is between 1 - 26.

Write the resulting letter at the end of the key.

Repeat this for each letter to get your decrypted word.

#### Example

Encrypted Word: JRNFGL Key: FWA

J, F -> 10 - 6 -> 4 -> D
R, W -> 18 - 23 -> -5 + 26 -> 21 -> U
N, A -> 14 - 1 -> 13 -> M
F, D -> 6 - 4 -> 2 -> B
G, U -> 7 - 21 -> -14 + 26 -> 12 -> L
L, M -> 12 - 13 -> -1 + 26 = 25 -> Y
Decrypted Word: DUMBLY

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.