On the Subject of Roger.pdf

Only use this manual as a last resort.

To solve this module, calculate a message code based on the 4─digit number shown on page 1 of the game manual using the process detailed below.

Section 0: Definitions, Functions, Constants, and Operations on Bit Strings and Integers

Subsection 0.0: Definitions

  1. A word is a 32-bit string, which may be represented as 8 hex digits. To convert between the two, each 4-bit string is replaced with its corresponding hex digit.
    • An integer x, satisfying the relationship 0 ⩽ x < 2^32, can be represented as a word.
  2. A block is a 512-bit string, which may be represented as a sequence of 16 words.

Subsection 0.1: Operations

  1. Bitwise logical operations follow their standard definitions.
    • X AND Y = bitwise logical “and” of X and Y
    • X OR Y = bitwise logical “or” of X and Y
    • X XOR Y = bitwise logical “exclusive-or” of X and Y
    • NOT X = bitwise logical “not” of X
  2. The operation X + Y on words X and Y, representing integers x and y is defined as follows: Let n % m be the remainder upon dividing n by m. Compute
    • z = (x + y) % 2^32
    Convert z to a word, Z, and define Z = X + Y
  3. The circular left shift operation S(X,n), where X is a word and n is an integer with 0 ⩽ n < 32, is defined by
    • S(X,n) = (X << n) OR (X >> 32-n)
    All shifts are logical shifts─always shift in zeroes.
  4. Bit padding is used to make the total length of the padded message a multiple of 512. This process then processes sequential blocks of 512 bits when calculating the message code. Suppose a message has length l < 2^64. Before the message is processed, it is padded on the right as follows:
    1. “1” is appended
    2. “0”s are appended until the length of the last block in the message is 448 bits.
    3. Obtain the 2-word representation of l, then append these two words to the padded message.

Subsection 0.2: Functions and Constants

A sequence of logical functions f(0) to f(79) is used in this message code. Each f(t), with 0 ⩽ t ⩽ 79 operates on words B, C, and D and produces a word as output. f(t,B,C,D) is defined as follows:

  1. f(t,B,C,D) = (B AND C) OR ((NOT B) AND D); for 0 ⩽ t ⩽ 19
  2. f(t,B,C,D) = B XOR C XOR D; for 20 ⩽ t ⩽ 39
  3. f(t,B,C,D) = (B AND C) OR (B AND D) OR (C AND D); for 40 ⩽ t ⩽ 59
  4. f(t,B,C,D) = B XOR C XOR D; for 60 ⩽ t ⩽ 79

A sequence of constant words K(0) to K(79) is also used. In hex, these words are:

  1. K(t) = 00196883; for 0 ⩽ t ⩽ 19
  2. K(t) = 01200145; for 20 ⩽ t ⩽ 39
  3. K(t) = 009080a2; for 40 ⩽ t ⩽ 59
  4. K(t) = 383f8128; for 60 ⩽ t ⩽ 79

Section 0.5: Preparing the Message

The message, in ASCII (page 3), consists of the string “Roger ” concatenated with the 4-digit code shown on the game manual. Convert each character into its corresponding byte, and concatenate all bytes together before processing.

Section 1: Calculating the Message Code

The message code is calculated using the message constructed in Section 0.5, padded as described in Subsection 0.1 ─ Bit padding. Before any blocks are processed, 10 variables are initialised as follows (in hex):

  • H0 = 9559b62d
  • H1 = 71884793
  • H2 = 1bb72471
  • H3 = deadbeef
  • H4 = f1ea5eed
  • A, B, C, D, E = 00000000.

Divide the padded message into blocks, and process each block in order, labeled M(1) to M(n), as M(i):

Perform the following:

  1. Divide M(i) into 16 words W(0) to W(15), where W(0) is the left-most word
    • For 16 ⩽ t ⩽ 79, W(t) = S(W(t-3) XOR W(t-8) XOR W(t-14) XOR W(t-16),1)
  2. Set A = H0, B = H1, C = H2, D = H3, E = H4
  3. For t = 0 to 79, do:
    • TEMP = S(A,5) + f(t;B,C,D) + E + W(t) + K(t);
    • E = D; D = C; C = S(B,30); B = A, A = TEMP;
  4. Let H0 = H0 + A, H1 = H1 + B, H2 = H2 + C, H3 = H3 + D, H4 = H4 + E

After processing M(n), the message code is the 160-bit string represented by the 5 words: H0 H1 H2 H3 H4

Section 2: Querying

After receiving the message code in hex, append the string “4275” to it, remove all letters, and take the first 4 characters from the resulting string. This is the code to query into the manual.