CRACK Solution

SINGLE KEY

CRACK xor cipher

In-game screenshot of SINGLE KEY
In-game view
FamilyCRACK Graph0.078 DifficultyTutorial Ring01 IDt03_xor

Prerequisites

SPLITTERBLINK

Unlocks

RAMP

Accepted input ZERO
Techniquexor cipher Rulenonzero SampleZERO

Walkthrough

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

Verifier Listing
; t03_xor: XOR cipher: each input byte XORed with the key 0x2a must equal the
; stored target sequence. Technique: single-key XOR (the classic). To recover the
; password, XOR each target byte by 0x2a. r0 = 1 on accept. Accept rule: nonzero.
;
; targets (after ^0x2a) = 0x70 0x6f 0x78 0x65  ->  password "ZERO".

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

        mov   r7, 0
        ldb   r0, [r7]
        xor   r0, 0x2a
        cmp   r0, 0x70
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        xor   r0, 0x2a
        cmp   r0, 0x6f
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        xor   r0, 0x2a
        cmp   r0, 0x78
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        xor   r0, 0x2a
        cmp   r0, 0x65
        jnz   bad

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