CRACK Solution

Rolling Key

CRACK chained (rolling) XOR

In-game screenshot of Rolling Key
In-game view
FamilyCRACK Graph0.277 DifficultyEasy Ring03 IDz1_rolling_xor

Prerequisites

Barrel Roll

Unlocks

Three Gates

Accepted input CRYPT0
Techniquechained (rolling) XOR Rulenonzero SampleCRYPT0

Walkthrough

Recover the accepted input below, then submit it to the CRACK verifier.

Reject Samples

  • CRYPT
  • CRYPT00
  • crypt0
  • CRYPTO
  • DRYPT0
Verifier Listing
; z1_rolling_xor: Rolling Key. A chained XOR where the key for each position is
; the PREVIOUS plaintext byte; the first uses a fixed seed 0x33. Each output
; depends on the one before it, so decode strictly left to right.
; r0 = 1 on accept (nonzero rule).
;
;   enc[0] = input[0] ^ 0x33
;   enc[i] = input[i] ^ input[i-1]   (i > 0)
; enc = { 0x70, 0x11, 0x0b, 0x09, 0x04, 0x64 } -> "CRYPT0". Length must be 6.
; Answer: CRYPT0  (last char is the digit zero)

        len   r1
        cmp   r1, 6
        jnz   bad           ; length must be exactly 6

        ; r2 holds the rolling key: the seed first, then the previous char.
        mov   r2, 0x33
        mov   r7, 0
        ldb   r0, [r7]      ; input[0]
        mov   r3, r0        ; keep the raw char to become the next key
        xor   r0, r2
        cmp   r0, 0x70
        jnz   bad
        mov   r2, r3

        inc   r7
        ldb   r0, [r7]      ; input[1]
        mov   r3, r0
        xor   r0, r2
        cmp   r0, 0x11
        jnz   bad
        mov   r2, r3

        inc   r7
        ldb   r0, [r7]      ; input[2]
        mov   r3, r0
        xor   r0, r2
        cmp   r0, 0x0b
        jnz   bad
        mov   r2, r3

        inc   r7
        ldb   r0, [r7]      ; input[3]
        mov   r3, r0
        xor   r0, r2
        cmp   r0, 0x09
        jnz   bad
        mov   r2, r3

        inc   r7
        ldb   r0, [r7]      ; input[4]
        mov   r3, r0
        xor   r0, r2
        cmp   r0, 0x04
        jnz   bad
        mov   r2, r3

        inc   r7
        ldb   r0, [r7]      ; input[5]
        xor   r0, r2
        cmp   r0, 0x64
        jnz   bad

        mov   r0, 1
        ret
bad:    mov   r0, 0
        ret