On the Subject of the Hill CM

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

The 2 numbers on screen 1 are labeled A and B and the 2 numbers on screen 2 are labeled C and D

If the Submit Button is white, use Matrix A. Otherwise, use Matrix B.

Split the encrypted word into pairs of letters. If there is an odd amount of letters, leave the last letter as the odd letter.

Turn each pair of letters into its alphabetic position (A1Y25Z0).

Take each pair of numbers and do the following:

  • Multiply the 1st number with the top left number of the matrix.
  • Multiply the 2nd number with the top right number of the matrix.
  • Sum the 2 numbers together, modulo 26, and turn it back to a letter (A1Y25Z0).
  • Do the same 3 steps using the 1st number with the bottom left number of the matrix and the 2nd number with the bottom right number of the matrix.
  • You should have a decrypted pair of letters.

Matrix A

AB
CD

Matrix B

AiBi
CiDi

The instructions to determine Ai, Bi, Ci, and Di are written on the next pages.

Example 1

Encrypted Word: SLQCTIJQ
Screen 1: 6, 19
Screen 2: 21, 17
Using Matrix A

SL → (19 * 6) + (12 * 19), (19 * 21) + (12 * 17) → 342, 603 mod 26 → 4, 5 → DE
QC → (17 * 6) + (3 * 19), (17 * 21) + (3 * 17) → 159, 408 mod 26 → 3, 18 → CR
TI → (20 * 6) + (9 * 19), (20 * 21) + (9 * 17) → 291, 573 mod 26 → 5, 1 → EA
JQ → (10 * 6) + (17 * 19), (10 * 21) + (17 * 17) → 383, 499 mod 26 → 19, 5 → SE
SLQCTIJQ → DECREASE

Decrypted Word: DECREASE

Example 2

Encrypted Word: AHINCLY
Screen 1: 3, 13
Screen 2: 14, 9
Using Matrix A

AH → (1 * 3) + (8 * 13), (1 * 14) + (8 * 9) → 107, 86 mod 26 → 3, 8 → CH
IN → (9 * 3) + (14 * 13), (9 * 14) + (14 * 9) → 209, 252 mod 26 → 1, 18 → AR
CL → (3 * 3) + (12 * 13), (3 * 14) + (12 * 9) → 165, 150 mod 26 → 9, 20 → IT
AHINCLY → CHARITY

Decrypted Word: CHARITY

The first thing to do is to figure out what I is inorder to get Ai, Bi, Ci, and Di. The variable E is equal to ((A * D) - (B * C)) mod 26.

Determining I - Logic Way

  • 1. Set up 7 variables: M, N, Q, R, T1, T2, T3.
  • 2. Set M equal to 26.
  • 3. Set N equal to E.
  • 4. Q is equal to M / N, rounded down.
  • 5. R is equal to M mod N.
  • 6. Set T1 equal to 0.
  • 7. Set T2 equal to 1.
  • 8. T3 is equal to T1 - (T2 * Q).
  • 9. Set M equal to N.
  • 10. Set N equal to R.
  • 11. Q is equal to M / N, rounded down.
  • 12. R is equal to M mod N.
  • 13. Set T1 equal to T2.
  • 14. Set T2 equal to T3.
  • 15. T3 is equal to T1 - (T2 * Q).
  • 16. Repeat steps 9 - 15 until R is equal to 0, stopping at step 12.
  • 17. I is equal to T2 mod 26.

Determining I - Brute Force Way

  • 1. Find K in this equation: ((K * 26) + 1) mod E = 0
  • 2. I is equal to: ((K * 26) + 1) / E
    • This can be used as well: (I * E) mod 26 = 1

Determining I - Degenerate Way

There's going to be a cheat sheet somewhere down the line. I might as well do it for them:

E1357911151719212325
I1921153197231151725

Rearrange the matrix like so:

D-B
-CA

Then multiply each number by I, modulo 26 to get your Ai, Bi, Ci, and Di

Example 3

Encrypted Word: DSRZ
Screen 1: 17, 12
Screen 2: 3, 17
Using Matrix B

(17 * 17) - (12 * 3) → 253 mod 26 → 19 (Find I) → 11

17 * 11-12 * 11
-3 * 1117 * 11
187-132
-33187
524
195

DS → (4 * 5) + (19 * 24), (4 * 19) + (19 * 5) → 476, 171 mod 26 → 8, 15 → HO
RZ → (18 * 5) + (0 * 24), (18 * 19) + (0 * 5) → 90, 342 mod 26 → 12, 4 → LD
DSRZ → HOLD

Decrypted Word: HOLD