On the Subject of the ElsieFour CM

A machine that knows no bounds when it comes to ciphers.

Create a key using the keyword on screen 1 and the Boolean Expression on screen A. Make sure to remove any Zs. Rearrange the key into a 5×5 matrix.

Take the letter displayed on screen B and label it the Marked Letter.

If the Submit Button is white, follow the instructions under Encrypt Instructions. Otherwise follow the instructions under Decrypt Instructions.

Encrypt Instructions

  • Take the Marked Letter’s alphabetic position, minus 1 (A0Y24) and modulo it by 5. This will be called R.
  • Take the Marked Letter’s alphabetic position, minus 1 (A0Y24) and divide it by 5, rounding down. This will be called D.
  • Find the Nth letter of the encrypted word in the Matrix and go right an R amount of times and down an D amount of times, wrapping around if needed.
  • The letter you end up on becomes your Nth decrypted letter.
  • Shift the row to the right that contains the Nth decrypted letter.
  • Shift the column down that contains the Nth encrypted letter.
  • Take the encrypted letter's alphabetic position, minus 1 (A0Y24) and modulo it by 5. This will be called R.
  • Take the encrypted letter's alphabetic position, minus 1 (A0Y24) and divide it by 5, rounding down. This will be called D.
  • Find the Marked Letter in the Matrix and go right an R amount of times and down an D amount of times, wrapping around if needed.
  • The letter you end up on becomes your new Marked Letter.

Decrypt Instructions

  • Take the Marked Letter’s alphabetic position, minus 1 (A0Y24) and modulo it by 5. This will be called L.
  • Take the Marked Letter’s alphabetic position, minus 1 (A0Y24) and divide it by 5, rounding down. This will be called U.
  • Find the Nth letter of the encrypted word in the Matrix and go left an L amount of times and up an U amount of times, wrapping around if needed.
  • The letter you end up on becomes your Nth decrypted letter.
  • Shift the row to the right that contains the Nth decrypted letter.
  • Shift the column down that contains the Nth encrypted letter.
  • Take the encrypted letter's alphabetic position, minus 1 (A0Y24) and modulo it by 5. This will be called R.
  • Take the encrypted letter's alphabetic position, minus 1 (A0Y24) and divide it by 5, rounding down. This will be called D.
  • Find the Marked Letter in the Matrix and go right an R amount of times and down an D amount of times, wrapping around if needed.
  • The letter you end up on becomes your new Marked Letter.

Finally, if any of the letters on screen 2 match at the same position as any of the letters of your encrypted word, replace that letter with a Z. You should now have an decrypted word.

Example 1

Encrypted Word: QHRNI
Marked Letter: T
Screen 2: CVMEN
Using Encrypt Rules

BCEFG
HJKLN
OQSTU
VWXPY
RAMID

T → 19 → R4 D3
Q + R4 + D3 → B

BCEFGGBCEFGACEF
HJKLNHJKLNHBKLN
OQSTUOQSTUOJSTU
VWXPYVWXPYVQXPY
RAMIDRAMIDRWMID

Q → 16 → R1 D3
T + R1 + D3 → F

F → 5 → R0 D1
H + R0 + D1 → O

GACEFGACEFRACEF
HBKLNHBKLNGBKLN
OJSTUUOJSTHOJST
VQXPYVQXPYUQXPY
RWMIDRWMIDVWMID

H → 7 → R2 D1
F + R2 + D1 → B

B → 1 → R1 D0
R + R1 + D0 → A

RACEFFRACEFWACE
GBKLNGBKLNGRKLN
HOJSTHOJSTHBJST
UQXPYUQXPYUOXPY
VWMIDVWMIDVQMID

R → 17 → R2 D3
B + R2 + D3 → C

C → 2 → R2 D0
N + R2 + D0 → R

FWACEFWACEVWACE
GRKLNNGRKLFGRKL
HBJSTHBJSTNBJST
UOXPYUOXPYHOXPY
VQMIDVQMIDUQMID

N → 13 → R3 D2
C + R3 + D2 → B

B → 1 → R1 D0
I + R1 + D0 → D

BOARD + CVMEN → BOARD
Decrypted Word: BOARD

Example 2

Encrypted Word: XOYQ
Marked Letter: D
Screen 2: SLNY
Using Decrypt Rules

ABCFG
HJKMN
OQRTV
WXYSU
PLIED

D → 3 → L3 U0
X + L3 + U0 → S

ABCFGABCFGABIFG
HJKMNHJKMNHJCMN
OQRTVOQRTVOQKTV
WXYSUUWXYSUWRYS
PLIEDPLIEDPLXED

X → 23 → R3 D4
D + R3 + D4 → R

R → 17 → L2 U3
O + L2 + U3 → E

ABIFGABIFGDBIFG
HJCMNHJCMNAJCMN
OQKTVOQKTVHQKTV
UWRYSUWRYSOWRYS
PLXEDDPLXEUPLXE

O → 14 → R4 D2
R + R4 + D3 → B

B → 1 → L1 U0
Y + L1 + U0 → R

DBIFGDBIFGDBIFE
AJCMNAJCMNAJCMG
HQKTVHQKTVHQKTN
OWRYSSOWRYSOWRV
UPLXEUPLXEUPLXY

Y → 24 → R4 D4
B + R4 + D4 → U

U → 20 → L0 U4
Q + L0 + U4 → O

SERO + SLNY → ZERO
Decrypted Word: ZERO

You can use the table below to get the values for moving Up/Right/Down/Left. Find the letter in the table and the column will be the horizontal movement while the row will be the vertical movement.

LR >
-----
DU
v
01234
0ABCDE
1FGHIJ
2KLMNO
3PQRST
4UVWXY