On the Subject of Red Huffman Ciphers

The least efficient cipher was never practical in the first place.

This module contains 3 screens, a keyboard, 2 arrows, and a submit button that displays the current page you’re on, in the format of “#/Y”, where Y is the total amount of pages.

Pressing the left or right arrow takes the defuser to the previous or next page, wrapping around the last page. The number of pages is dependent on how long the binary string was used to generate the word. On average, there are 2 pages.

To disarm the module, decrypt a word using the following steps. Once you have the decrypted word, type it in using the keyboard. When you start typing, the screens go blank and the bottom screen will show what you are typing.

To clear your input, click one of the arrows.
Once you are satisfied with your input, press the button labeled “SUB” to submit your answer. An incorrect submission will cause a strike but NOT reset the module.

Step 1: Binary Retrieval

ChrBinChrBinChrBinChrBinChrBinChrBinChrBinChrBin
A0000 B0001 C0010 D0011 E0100 F0101 G0110 H0111
I1000 J1001 K1010 L1011 M1100 N1101 O1110 P1111
Q00 R01 S10 T11 U0 V1

Each page consists of up to 18 characters that were used to encode the original message. Create one long character string from the pages in reading order. Convert these characters displayed into their binary counterparts, to create one long binary string as a result. You will need this for the next two steps.

Step 2: Constructing The Huffman Tree

Using the binary string obtained, perform the following procedure until obtaining 26 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.

Example — Red Huffman Cipher Tree Construction

The first 8 splits are shown here.
Starting Binary String: 0111100000110101
[0]111100000110101

[0][1]

Binary String After Split #1: 111100000110101
[1]11100000110101

[00][01][1]

Binary String After Split #2: 11100000110101
[11]100000110101

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

Binary String After Split #3: 100000110101
[10]0000110101

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

Binary String After Split #4: 0000110101
[00]00110101

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

Binary String After Split #5: 00110101
[001]10101

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

Binary String After Split #6: 10101
[101]01

[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]

Step 3: Reading The Huffman Tree

Assign each letter in the alphabet to each leafing node in the Huffman Tree, prioritizing strings starting with 0.

Read binary digits until encountering a leafing node that ONLY starts with that portion of the remaining binary string. Note down that letter and separate that portion out of the binary string. Repeat these steps until you have exhausted your binary string. All of the letters obtained in that order will form the deciphered word.

Example — Red Huffman Cipher Binary Read

4 letters are read in this example, using BLACKSMITH as the alphabet.

Starting Binary String: 1001011010011

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

“100”, S
Current Binary String After Letter #1: 1011010011

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

“1011”, I
Current Binary String After Digit #2: 010011

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

“010”, C
Current Binary String After Digit #3: 011

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

“011”, K
Decoded Word: SICK