CRACK Solution
Minus Seven
CRACK subtract-constant cipher

Prerequisites
Unlocks
KEY7
Techniquesubtract-constant cipher
Rulenonzero
SampleKEY7
Walkthrough
Recover the accepted input below, then submit it to the CRACK verifier.
Reject Samples
- KEY
- KEY77
- key7
- LEY7
Verifier Listing
; z1_sub_const: Minus Seven. An arithmetic cipher using subtraction: 7 is
; subtracted from each input byte before the compare. The sub with immediate 7 is
; the tell. Reverse by adding 7 back to each stored byte. r0 = 1 on accept.
;
; (input[i]: 7) must equal enc[i], enc = { 0x44, 0x3e, 0x52, 0x30 }.
; enc[i] + 7 -> { 'K','E','Y','7' }. Length must be 4. Answer: KEY7
len r1
cmp r1, 4
jnz bad ; length must be exactly 4
mov r7, 0
ldb r0, [r7]
sub r0, 7
cmp r0, 0x44
jnz bad
inc r7
ldb r0, [r7]
sub r0, 7
cmp r0, 0x3e
jnz bad
inc r7
ldb r0, [r7]
sub r0, 7
cmp r0, 0x52
jnz bad
inc r7
ldb r0, [r7]
sub r0, 7
cmp r0, 0x30
jnz bad
mov r0, 1
ret
bad: mov r0, 0
ret