## On the Subject of the Chain Bit-Rotation CM

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

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

#### Decrypt Instructions

For this step, you will need the keyword from screen 1. If the keyword is shorter than the encrypted word, append repetitions of it to it until it is the same length or longer.

Start with the number on screen A, then carry out the following steps for every letter of the encrypted word: (1) multiply the number by 26; (2) add the alphabetic position of the letter. If the letter is Z, add 0 instead.

Convert this number to binary. Let n = 5 times the number of letters in the encrypted word. Then:

• Cycle the least significant n bits to the right by m bits. Here, m is the alphabetic position of the next letter in the keyword. (Make sure to cycle all n bits; if your number has fewer digits, add leading zeros.)
• Remove the least significant 5 bits from the number and convert them to a letter (A = 00001 ... Z = 11010).
• Reduce n by 5.

Repeat this as many times as there were letters in the encrypted word.

#### Decrypt Example

Encrypted word: OCRQOV; initial value: 1; keyword: BUSBOY
Calculation: (((((1 × 26 + 15) × 26 + 3) × 26 + 18) × 26 + 17) × 26 + 15) × 26 + 22
Binary: 011101001000110000101000100000

Cycle last 30 bits right by B=2: 000111010010001100001010001000 → 8 → H
Cycle last 25 bits right by U=21: 1101001000110000101000001 → 1 → A
Cycle last 20 bits right by S=19: 10100100011000010101 → 21 → U
Cycle last 15 bits right by B=2: 001010010001100 → 12 → L
Cycle last 10 bits right by O=15: 0010000101 → 5 → E
Cycle last 5 bits right by Y=25: 00100 → 4 → D

Decrypted Word: HAULED

#### Encrypt Instructions

For this step, you will need the keyword from screen 1. If the keyword is shorter than the encrypted word, append repetitions of it to it until it is the same length or longer.

Convert the number on screen A to binary as your starting number. Also start with n = 5. Then carry out the following steps for every letter of the encrypted word in backwards order (right to left):

• Convert the letter to a 5-digit binary number (A = 00001 ... Z = 11010). Append these 5 bits to the end of the number.
• Cycle the least significant n bits to the left by m bits. Here, m is the alphabetic position of the letter in the keyword in the same position. (Make sure to cycle all n bits; if your number has fewer digits, add leading zeros.)
• Increase n by 5.

Now convert the number back into letters by repeating the following process as many times as there were letters in the encrypted word:

• Take the number modulo 26. This yields the alphabetic position of the next decrypted letter. If the result is 0, your next letter is Z.
• Divide the number by 26, rounding down.

Ignore any surplus at the end. Finally, reverse the decrypted word.

#### Encrypt Example

Encrypted word: ZKMIHR; initial value: 0; keyword: QUARTERS

Append R=10010, cycle left by E=5: 10010
Append H=01000, cycle left by T=20: 1001001000
Append I=01001, cycle left by R=18: 100100001001100
Append M=01101, cycle left by A=1: 00100001001100011011
Append K=01011, cycle left by U=21: 1011001000010011000110110
Append Z=11010, cycle left by Q=17: 001101101101010110010000100110

229991462 % 26 = 12 = L | 229991462 / 26 = 8845825
8845825 % 26 = 1 = A | 8845825 / 26 = 340224
340224 % 26 = 14 = N | 340224 / 26 = 13085
13085 % 26 = 7 = G | 13085 / 26 = 503
503 % 26 = 9 = I | 503 / 26 = 19
19 % 26 = 19 = S

LANGIS → reverse → Decrypted Word: SIGNAL