CRACK Solution

Two Compares

CRACK two cmp

In-game screenshot of Two Compares
In-game view
FamilyCRACK Graph0.070 DifficultyTutorial Ring01 IDu02_two_compare
Accepted input GO
Techniquetwo cmp Rulenonzero SampleGO

Walkthrough

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

Verifier Listing
; u02_two_compare: two character compares plus a length check: the byte after
; the two characters must be the end of input (offset 2 reads 0 past the end), so
; the input is exactly "GO". Technique: two cmp + null-terminator length check.
; r0 = 1 on accept. Accept rule: nonzero.
;
; 0x47 = 'G', 0x4f = 'O'.

        mov   r7, 0
        ldb   r0, [r7]
        cmp   r0, 0x47      ; 'G'
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        cmp   r0, 0x4f      ; 'O'
        jnz   bad
        inc   r7
        ldb   r0, [r7]      ; byte after "GO" must be the terminator (0)
        cmp   r0, 0
        jnz   bad

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