CRACK Solution

Two Stage

CRACK multi-gate

In-game screenshot of Two Stage
In-game view
FamilyCRACK Graph0.083 DifficultyTutorial Ring01 IDm01_two_stage
Accepted input ARMASM
Techniquemulti-gate Rulenonzero SampleARMASM

Walkthrough

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

Verifier Listing
; m01_two_stage: two independent gates. Gate 1 checks the first three bytes;
; only if it passes does gate 2 check the next three. Both must be satisfied at
; once, and the total length must be exactly 6. Technique: multi-gate (two
; separate reject paths). r0 = 1 on accept. Accept rule: nonzero.
;
; gate 1 = "ARM" (0x41 0x52 0x4d), gate 2 = "ASM" (0x41 0x53 0x4d) -> "ARMASM".

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

        ; --- gate 1: first three bytes must be "ARM" ----------------------
        mov   r7, 0
        ldb   r0, [r7]
        cmp   r0, 0x41      ; 'A'
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        cmp   r0, 0x52      ; 'R'
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        cmp   r0, 0x4d      ; 'M'
        jnz   bad

        ; --- gate 2: next three bytes must be "ASM" -----------------------
        inc   r7
        ldb   r0, [r7]
        cmp   r0, 0x41      ; 'A'
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        cmp   r0, 0x53      ; 'S'
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        cmp   r0, 0x4d      ; 'M'
        jnz   bad

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