CRACK Solution
Position Matters
CRACK weighted checksum

Prerequisites
Unlocks
SECTOR9
Techniqueweighted checksum
Rulenonzero
SampleSECTOR9
Walkthrough
Recover the accepted input below, then submit it to the CRACK verifier.
Reject Samples
- SECTOR8
- 9ROTCES
- AAAAAAA
- SECTOR90
Verifier Listing
; z3_weighted_sum: "Position Matters". Not a plain byte sum: each byte is
; weighted by its 1-based position before summing. sum = 1*c0 + 2*c1 + ... + N*cN-1.
; The multiply-by-running-index in the loop is the tell. Technique: weighted
; checksum. r0 = 1 on accept. Accept rule: nonzero.
;
; 8-BIT NOTE: the ARM original sums to 2044 (0x7FC), which overflows a byte.
; The byte-wide engine keeps the weighted total mod 256, so the gate is the LOW
; BYTE of that sum: 2044 & 0xFF = 0xFC. Same technique (position*value fold,
; multiply seen in the loop), same difficulty, reduced to the 8-bit ceiling.
;
; sample "SECTOR9": 1*S + 2*E + 3*C + 4*T + 5*O + 6*R + 7*'9' = 2044; low byte 0xFC.
len r2
cmp r2, 7
jnz bad ; exactly 7 bytes
mov r3, 0 ; r3 = running weighted sum (mod 256)
mov r7, 0 ; r7 = index 0..6
mov r4, 1 ; r4 = weight = index + 1
wloop: cmp r7, 7
jge final
ldb r0, [r7] ; r0 = input[r7]
; r5 = weight * byte, by repeated add (weight is small: 1..7)
mov r5, 0
mov r1, r4 ; loop r4 times
mulw: cmp r1, 0
jz addt
add r5, r0
dec r1
jmp mulw
addt: add r3, r5 ; running sum += weight*byte (wraps mod 256)
inc r4 ; next weight
inc r7
jmp wloop
final: cmp r3, 0xFC ; low byte of 2044
jnz bad
mov r0, 1
ret
bad: mov r0, 0
ret