CRACK Solution
Position Add
CRACK position-dependent add cipher

Prerequisites
Unlocks
MIPS
Techniqueposition-dependent add cipher
Rulenonzero
SampleMIPS
Walkthrough
Recover the accepted input below, then submit it to the CRACK verifier.
Reject Samples
- MIP
- MIPSX
- mips
- NIPS
Verifier Listing
; z1_add_walk: Position Add. A position-dependent cipher: byte i has its own
; index i added before the compare. The key is not a constant, it grows with the
; position. Reverse by subtracting the position from each stored byte.
; r0 = 1 on accept (nonzero rule).
;
; (input[i] + i) must equal enc[i], enc = { 0x4d, 0x4a, 0x52, 0x56 }.
; enc[i]: i -> { 'M','I','P','S' }. Length must be 4. Answer: MIPS
len r1
cmp r1, 4
jnz bad ; length must be exactly 4
mov r7, 0
ldb r0, [r7]
add r0, 0 ; + position 0
cmp r0, 0x4d
jnz bad
inc r7
ldb r0, [r7]
add r0, 1 ; + position 1
cmp r0, 0x4a
jnz bad
inc r7
ldb r0, [r7]
add r0, 2 ; + position 2
cmp r0, 0x52
jnz bad
inc r7
ldb r0, [r7]
add r0, 3 ; + position 3
cmp r0, 0x56
jnz bad
mov r0, 1
ret
bad: mov r0, 0
ret