CRACK Solution

Even/Odd Keys

CRACK alternating XOR keys

In-game screenshot of Even/Odd Keys
In-game view
FamilyCRACK Graph0.250 DifficultyEasy Ring02 IDllama_alt_xor
Accepted input ZONE
Techniquealternating XOR keys Rulenonzero SampleZONE

Walkthrough

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

Reject Samples

  • ZON
  • ZONES
  • zone
  • YONE
Verifier Listing
; llama_alt_xor: two XOR keys alternating by position. Even positions are XORed
; with 0x0F, odd positions with 0xF0, then compared to a stored target. XOR is
; self-inverse. Technique: alternating XOR keys (even/odd). r0 = 1 on accept.
; Accept rule: nonzero.
;
; targets = 0x55 0xBF 0x41 0xB5  ->  password "ZONE"
;   pos0 'Z'^0x0F=0x55, pos1 'O'^0xF0=0xBF, pos2 'N'^0x0F=0x41, pos3 'E'^0xF0=0xB5

        len   r1
        cmp   r1, 4
        jnz   bad           ; exactly 4 bytes

        mov   r7, 0
        ldb   r0, [r7]
        xor   r0, 0x0f      ; even key
        cmp   r0, 0x55
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        xor   r0, 0xf0      ; odd key
        cmp   r0, 0xbf
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        xor   r0, 0x0f      ; even key
        cmp   r0, 0x41
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        xor   r0, 0xf0      ; odd key
        cmp   r0, 0xb5
        jnz   bad

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