CRACK Solution

Add Cipher

CRACK arithmetic cipher

In-game screenshot of Add Cipher
In-game view
FamilyCRACK Graph0.077 DifficultyTutorial Ring01 IDt04_add_cipher

Prerequisites

DOUBLE TAP

Unlocks

THRESHOLD GATE

Accepted input CODE
Techniquearithmetic cipher Rulenonzero SampleCODE

Walkthrough

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

Verifier Listing
; t04_add_cipher: additive cipher. Each input byte has 1 added before the
; compare (the encoded byte was input+1). To reverse, subtract 1 from each stored
; byte. Technique: arithmetic (add) cipher. r0 = 1 on accept. Accept rule: nonzero.
;
; stored (input+1) = 0x44 0x50 0x45 0x46 -> each -1 -> "CODE".

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

        mov   r7, 0
        ldb   r0, [r7]
        add   r0, 1
        cmp   r0, 0x44      ; 'C'+1
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        add   r0, 1
        cmp   r0, 0x50      ; 'O'+1
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        add   r0, 1
        cmp   r0, 0x45      ; 'D'+1
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        add   r0, 1
        cmp   r0, 0x46      ; 'E'+1
        jnz   bad

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