## On the Subject of the Affine CM

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

Turn each letter of the encrypted word into its alphabetic position (A1Y25Z0). These numbers will be your Cs to decrypt.

The number on screen 1 is E and the letter on screen A is X.

Convert the variable X to a Value via the Value Table. Take the resulting value, modulo 25, plus 1. This is your actual X value.

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

Take each number C through the equation then turn it back to a letter.

#### Equation A

((C * E) + X) mod 26

#### Equation B

((C - X) * D) mod 26

The instructions to determine D are written on the next page.

#### Example

Encrypted Word: PUKNE
E: 7
X: S → (9 % 25) + 1 = 10
Submit Button: White

P → ((16 * 7) + 10) % 26 → 18 → R
U → ((21 * 7) + 10) % 26 → 1 → A
K → ((11 * 7) + 10) % 26 → 9 → I
N → ((14 * 7) + 10) % 26 → 4 → D
E → ((5 * 7) + 10) % 26 → 19 → S

Decrypted Word: RAIDS

### Determining D - Logic Way

• 1. Set up 7 variables: A, B, Q, R, T1, T2, T3.
• 2. Set A equal to 26.
• 3. Set B equal to E.
• 4. Q is equal to A / B, rounded down.
• 5. R is equal to A mod B.
• 6. Set T1 equal to 0.
• 7. Set T2 equal to 1.
• 8. T3 is equal to T1 - (T2 * Q).
• 9. Set A equal to B.
• 10. Set B equal to R.
• 11. Q is equal to A / B, rounded down.
• 12. R is equal to A mod B.
• 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. Your D is equal to T3 mod 26.

### Determining D - Brute Force Way

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

### Determining D - Degenerate Way

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

 E D 3 5 7 9 11 15 17 19 21 23 25 9 21 15 3 19 7 23 11 5 17 25