On the Subject of Unfair’s Forgotten Ciphers

Some ciphers were meant to be forgotten after all. Were they “really unfair” in the first place?

The display on the top shows an encrypted message. There is also a strip of LEDs underneath the display which will light up depending on what page the defuser is on.

In this state, the buttons in the middle can be selected at any point to cycle between pages and toggle between submitting the words and viewing pages.

All ciphers mentioning the alphabet in this manual will correspond to the English alphabet: “ABCDEFGHIJKLMNOPQRSTUVWXYZ”, unless otherwise stated. Alphabetic position mentioned in this manual will correspond to the A1Z26 equivalents, unless otherwise stated.

The right screen on page 1 will always have its strike counter in RED and its module ID in WHITE.

The functions for the buttons while the module is not in submission mode is the following, with the directional button representing the buttons in between Inner Center and Outer Center:

  • Left: Go to page 1 on the module.
  • Up: Go to page 2 on the module.
  • Right: Go to page 3 on the module.
  • Down: Go to page 4 on the module.
  • Outer Center: Toggle between submission and viewing pages.
  • Inner Center: If held, shows the names of the colors displayed on pages 3 and 4. This can be used EVEN IF the user has colorblind mode disabled for this module.
  • Right Screen: Swaps contents displayed on the right and top. The manual will refer to the instructions as if the right screen was not pressed at all.

Decrypting — Step 1: Binary Code Retrieval And Completing The Keystring

On page 2, there is a long string on the top and right displays. The binary string is obtained by the following procedure:

  1. Concatenate the text displayed on page 2’s top and right screen in that order. Treat this as one complete string.
  2. Decode the binary digits using the table provided to obtain the substituted digits. Note that MULTIPLE substitutions are required to obtain the binary string.
SubstitutedEncodedSubstitutedEncodedSubstitutedEncoded
0A1BAAC
BADABEBBF
CAGCBHDAI
DBJEAKEBL
FAMFBNAGO
BGPAHQBHR
AISBITAJU
BJVAKWBKX
ALYBLZ
  1. On page 3, both screens consist of up to 9 keywords, each when concatenated and only accounting for first occurrences of each letter, form a keystring that will be used to decrypt using the completed Huffman tree.
    • Concatenations should be done in reading order of the keywords obtained, starting with the top screen, then the right screen.
    • If a keyword contains all of the letters previously used when concatenating, discard that entire keyword instead.

Decrypting — Step 2: Red Huffman Cipher

How did Gryffindor come into here in the first place? Was it something about Hufflepuff’s games?

Using the binary string obtained, perform the following procedure until obtaining 10 leafing nodes, where a leafing node is a node at the end of the tree. Digits must be read once from left to right, and never trace back.

  1. Start with the following leafing nodes “0” and “1”.
  2. Read binary digits, in a sequence, until encountering a node that ONLY starts with that binary sequence.
  3. Split the only entry into two parts, with both entries starting with the binary sequence and ending with “0” and “1” respectively. Maintain the order of the leafing nodes when splitting.
  4. Repeat the previous 2 steps.

After obtaining a portion of the Huffman tree, you then must use the binary string to obtain numbers, that will be used for the 3×3 Hill Cipher. 18 digits should be obtained this way before continuing to construct the Huffman tree.

  1. Assign each leafing node, digits 0-9 in that order, prioritizing the nodes starting with 0 in the sequence.
  2. Read binary digits until encountering a leafing node. Note down that digit and restart at the top.
  3. Repeat the previous step, until enough digits have been obtained in this state.

Once obtaining the 18 digits, resuming constructing the Huffman tree until 16 more leafing entries have been constructed. 26 leafing entries should be created up to this point. Assign each letter in the keystring to each leafing node, prioritizing the nodes starting with 0.

Read through the binary string one more time to get a 4-8 letter word. This is the keyword for the next step. The rest of the binary string will form the exact same letter, which can be discarded.

Example — Red Huffman Cipher Construction

The first 8 iterations are shown here.

Starting Binary String: 0111100000110101

[0][1]

Binary String After Split #1: 111100000110101

[00][01][1]

Binary String After Split #2: 11100000110101

[00][01][10][11]

Binary String After Split #3: 100000110101

[00][01][10][110][111]

Binary String After Split #4: 0000110101

[00][01][100][101][110][111]

Binary String After Split #5: 00110101

[000][001][01][100][101][110][111]

Binary String After Split #6: 10101

[000][0010][0011][01][100][101][110][111]

Binary String After Split #7: 01

[000][0010][0011][01][100][1010][1011][110][111]

Leafing Nodes After 8 Splits:

[000][0010][0011][010][011][100][1010][1011][110][111]

Example — Red Huffman Cipher Binary Read

6 digits are read in this example.

Starting Binary String: 0001011001100110010111

[000][0010][0011][010][011][100][1010][1011][110][111]
0123456789

“000”, 0

Current Binary String After Digit #1: 1011001100110010111

[000][0010][0011][010][011][100][1010][1011][110][111]
0123456789

“1011”, 7

Current Binary String After Digit #2: 001100110010111

[000][0010][0011][010][011][100][1010][1011][110][111]
0123456789

“0011”, 2

Current Binary String After Digit #3: 00110010111

[000][0010][0011][010][011][100][1010][1011][110][111]
0123456789

“0011”, 2

Current Binary String After Digit #4: 0010111

[000][0010][0011][010][011][100][1010][1011][110][111]
0123456789

“0010”, 1

Current Binary String After Digit #5: 111

[000][0010][0011][010][011][100][1010][1011][110][111]
0123456789

“111”, 9

Digits obtained: 072219

Decrypting — Step 3: RGBA Decomposition Cipher

The diagram provided shows all 27 possible colors that can show up on this module. 6 LEDs are colored on page 3 of the module, such that when used on each letter and operator, will correspond to a decrypted letter’s position.

Use the keyword obtained from step 2, remove any duplicate letters, and retain the first occurrences of each. Form the alphabet and exclude letters from the keyword.

On the right screen of page 1, if “MODULE ID:” is present for the module ID, place the alphabet at the end of the keyword (FORGETABCDHIJKLMNPQSUVWXYZ). Otherwise, place the alphabet at the start of the keyword (ABCDHIJKLMNPQSUVWXYZFORGET).

On page 4, 3 LEDs will be shown in different shades of Red, Green, and Blue, though these shades may not appear in this order. Each channel corresponding to the 3 LEDs has one of three values, “-” (off), “0” (dim), and “+” (bright). Each LED has a value that is different from the other channels. From the left LED to the right, these channels that have the distinct value constitute the order of placing the letters. The order of placing letters starts at - and ends at +, according to the diagram provided. When rearranged in RGB order, they will also correspond to the color that should be skipped over when placing the keystring formed before.

  • If 0 is one of the distinct values used for that LED, its channel is represented by the non-zero value. (Example: 0+0, non-zero value is +)
  • Otherwise, its channel is represented as 0.

Decrypting — Step 3: RGBA Decomposition Cipher (Continued)

Convert letters from the top screen of page 1 to their colors, resulting in 6 triplets, representing R, G and B respectively. Rearrange the 6 triplets formed from the base message into 3 separate right triangles corresponding to those channels, whose base and height is 3 digits long, in reading order. Page 4 consists of 3 strings denoting transformations denoted for each channel. The 3 strings displayed on the top screen will be in RGB order from top to bottom, shifted to the right by the number of ports, in RGB order (R -> G -> B), wrapping around to R if on B. Transformations are then applied in the order displayed on the module. If a channel has “NONE”, no transformations would be applied to that channel. Grabbing the transformed triplets and the displayed colors should form 6 pairs of triplets.

  • “TL”: Flip individual rows horizontally of that channel.
  • “TR”: Flip individual columns vertically of that channel.
  • “BL”: Swap rows and columns of that channel. (B1 <-> A2)
  • “BR”: That channel is inverted. In other words, - -> + and vice versa for that channel; channels with a value of 0 should not be modified with this.

The used operators are displayed on page 4’s right screen. These operators are applied in order of the formed pairs of triplets, wrapping around to the first operator while using the letters. The module will describe the symbol for each due to how some symbols are improperly rendered. Each description should ONLY correspond to exactly 1 operator’s symbol.

Using the displayed operators correspond to the table that should be used to decrypt. These tables are applied to each pair of triplets, regardless of which of the pair is assigned a row/column.

+-0+
---0
0-0+
+0++
×-0+
-+0-
0000
+-0+
-0+
--+0
0+0-
+0-+
m-0+
----
0-00
+-0+
M-0+
--0+
000+
++++
-0+
-0-+
0-0-
++-0

Finally, converting each triplet back into the letter using the constructed keystring from before should result in the decrypted string.

Example — RGBA Decomposition Cipher

Obtained from Page 1 Top Screen: AEIPAZ

Keyword: AMBITION

Displayed 6 LED Colors On Page 3: Mint, Plum, Indigo, Forest, Rose, Magenta

Displayed 3 LED Colors On Page 4: Mint, Red, Indigo (G: +, R: 0, B: -)

Displayed Transformations: “TL, BR”; “BR, TR”; “BR, BL”

Port Count, Modulo 3: 1

Interpreted Operators: +, ○ (From “Plus Symbol”, “Circle”)

“Module ID” is shown.

Determined Color from 3 LEDs: 0+- (Lime)

G-0+-0+-0+-0+- 0+-0+-0+-0+-0+
R---000+++---0 00+++---000+++
B---------0000 00000+++++++++
AMBIT!ONCDEF GHJKLPQRSUVWXYZ

Rearranged to RGB Order:

R---000+++---0 00+++---000+++
G-0+-0+-0+-0+- 0+-0+-0+-0+-0+
B---------0000 00000+++++++++
AMBIT!ONCDEF GHJKLPQRSUVWXYZ

AEIPAZ = ---, -00, 0--, ++0, ---, +++ (RGB)

R Channel Transforms
--0
+-
+
BR
++0
-+
-
BL
+--
++
0
G Channel Transforms
-0-
+-
+
TL
-0-
-+
+
BR
+0+
+-
-
B Channel Transforms
-0-
0-
+
BR
+0+
0+
-
TR
-++
00
+

Rearranged: ++-, -0+, -++, ++0, +-0, 0-+

Converted LED Colors: 0+0, 0-0, --0, -0-, +-0, +-+

Result after using operators: ++-, ++-, -0+, 0-+, +-0, --+

Decrypted: ++-, ++-, -0+, 0-+, +-0, --+ = CCRUKQ

Decrypting — Step 4: 3×3 Hill Cipher

Of course this showed up. People are going to use freaking tools to decrypt that now! How could you!?

The 18 digits obtained from step 2 form 9 sets of 2-digit values that are part of a 3×3 matrix in reading order. These are labeled a - i on this manual. To decrypt:

X, the determinant of a 3×3 matrix, is obtained as such:

3×3 Matrix Determinant

Y, the multiplicative inverse of the determinant obtained previously, is then found such that X times Y, all modulo P, the length of the alphabet (26), is equal to 1. Whatever method used, should result in this statement being true.

Multiplicative Inverse

Decrypting — Step 4: 3×3 Hill Cipher (Continued)

The adjugate of the original matrix can be formed by obtaining the cofactor of the 3×3 matrix, and then flipping across the diagonal from top-left to bottom-right.

3×3 Matrix Adjugate

Decrypting — Step 4: 3×3 Hill Cipher (Continued)

Multiplying the adjugated matrix by Y and then calculating the determinants of the 2×2 matrices inside the 3×3 matrix will obtain the inverse matrix.

3×3 Matrix Inverse

To use the inverse matrix, group the letters decrypted from step 3 into sets of 3, and obtain the alphabetic positions of each, with Z equating to 0. Treat each as a 1×3 matrix, and multiply the 1×3 matrix by the inverse 3×3 matrix. The first value of the 1×3 matrix is multiplied to the first column of the 3×3 matrix; the same applies for the 2nd and 3rd values of the 1×3 matrix respectively. Add the multiplied values, row by row, to get 3 separate values. Modulo the separate values by the length of the alphabet and convert them back into their respective letter via alphabet position, with 0 equating to Z.

Example — 3×3 Hill Cipher Obtaining Matrix Inverse

Obtained Matrix:

72219
21915
111622

Determinant: 7*9*22 + 22*15*11 + 19*21*16 - 7*15*16 - 22*21*22 - 19*9*11 = -2325

-2325 mod 26 = 15

15 * b = 1 mod 26, b = 7

Adjugate:

915
1622
-
2219
1622
2219
915
-
2115
1122
719
1122
-
719
2115
219
1116
-
722
1116
722
219

Inverse:

7*(9*22-15*16) -7*(22*22-19*16) 7*(22*15-19*9)
-7*(21*22-11*15) 7*(7*22-19*11) -7*(7*15-19*21)
7*(21*16-9*11) -7*(7*16-22*11) 7*(7*9-22*21)

-294-12601113
-2079-3852058
1659910-2793

Example — 3×3 Hill Cipher Using The Inverse Matrix

Inverse Matrix Obtained (after mod 26):

181421
154
21015

Encrypted: CCRUKQ

Alphabetic positions of each encrypted letter: 3, 3, 18, 21, 11, 17

3*18 + 3*14 + 18*21 = 474, 474 mod 26 = 6, F

3*1 + 3*5 + 18*4 = 90, 90 mod 26 = 12, L

3*21 + 3*0 + 18*15 = 333, 333 mod 26 = 21, U

21*18 + 11*14 + 17*21 = 889, 889 mod 26 = 5, E

21*1 + 11*5 + 17*4 = 144, 144 mod 26 = 14, N

21*21 + 11*0 + 17*15 = 696, 696 mod 26 = 20, T

Decrypted: FLUENT

Submitting The Word

One last trick.

When pressing Outer Center to enter submission, the 4 buttons in between Inner Center and Outer Center will turn into different shades of gray.
Pressing Outer Center will exit out of submission mode and can be pressed at any point in time.

For all other presses (excluding the screen), any press of those buttons will unlock the submission, but not pressing at the correct time will result in a strike. Submission will be left unlocked, even after a strike from submitting.

  • Start with the last digit of the serial number, and add the module ID to it.
  • Add the number of letters that comes before N, excluding N, in all of the unlit indicators.
  • To the current value, if on line 2 of page 1, the strike counter has “STRIKE(S)” appended to the number, add the number of letters that comes before N, excluding N, in all of the lit indicators. Otherwise, if on line 2 of page 1, the strike counter has “STRIKE(S):” prepended to the number, add the number of batteries. Otherwise, add the sum of the number of battery holders and the number of port plates.
  • Subtract 3 times the amount of modules with “Fair” in its name, either as part of a word, or as its own word. This is case insensitive.
  • Add 3, and modulo the result by 10. When the last seconds digit of the countdown timer is that digit, the module will not strike when unlocking.

Once submission has been unlocked, the right display will show indications of what buttons access which portion of the module.

Pressing Left, Up, or Right will respectively input -, 0, or + into the right screen, which is then inputted into a letter to be displayed on the top screen.

Pressing Down will delete the displayed inputs on the right screen if there has been any, or delete the last letter on the top screen otherwise.

Pressing Inner Center will submit the letters on the top screen.

Pressing Outer Center will clear the entire input and exit submission.

If the submitted word is correct, the module will disarm. Otherwise the module will strike and exit submission as a result. The correct word will NOT change.

For reference, for the first input displayed on the right, inputting -, 0, or + will enter to the sections of the alphabet A-I, J-R, S-Z respectively. The second input is a 3 letter subsection of the first input, with the third input being a letter. “?” will be used to denote invalid letters.