CRACK Solution

XOR Door

CRACK XOR cipher

In-game screenshot of XOR Door
In-game view
FamilyCRACK Graph0.080 DifficultyTutorial Ring01 IDt03_xor_intro
Accepted input exit
TechniqueXOR cipher Rulenonzero Sampleexit

Walkthrough

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

Verifier Listing
; t03_xor_intro: XOR door. Each input byte is XOR'd with the single key 0x20
; (the ASCII case bit) and compared to a stored uppercase byte. XOR is its own
; inverse: XOR each stored byte by 0x20 to recover the answer. Technique: single
; key XOR. r0 = 1 on accept. Accept rule: nonzero.
;
; stored (uppercase) = 0x45 0x58 0x49 0x54 -> each ^0x20 -> "exit".

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

        mov   r7, 0
        ldb   r0, [r7]
        xor   r0, 0x20
        cmp   r0, 0x45      ; 'E'
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        xor   r0, 0x20
        cmp   r0, 0x58      ; 'X'
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        xor   r0, 0x20
        cmp   r0, 0x49      ; 'I'
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        xor   r0, 0x20
        cmp   r0, 0x54      ; 'T'
        jnz   bad

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