CRACK Solution

Zig Zag

CRACK alternating add/subtract fold checksum keygen

In-game screenshot of Zig Zag
In-game view
FamilyCRACK Graph0.917 DifficultyHard Ring05 IDz7_altfold

Prerequisites

LATCHED ECHO

Unlocks

COMMON FACTOR

Accepted input 2461351
Techniquealternating add/subtract fold checksum keygen Rulenonzero Sample2461351

Walkthrough

The checksum here refuses to just add up. It walks the digits adding one, subtracting the next, adding the one after, zig then zag, and folds the running total to a single digit. Mirror the dance to forge a serial that checks out.

Run an alternating fold over the six body digits: add the first, subtract the second, add the third, and so on in 8-bit arithmetic, then take the result mod 10. That digit is the check.

Hints

  • HINT 1: The serial is seven digits: six body digits and a check digit. Watch the sign flip on every digit.
  • HINT 2: Start at zero, add digit 0, subtract digit 1, add digit 2, subtract digit 3, add digit 4, subtract digit 5; keep it in a byte.
  • HINT 3: For body 246135 the fold lands on 1, and 1 mod 10 is 1, so 2461351 passes.

Reject Samples

  • 2461350
  • 2461352
  • 2461361
  • 3461351
  • 246135
  • 24613510
  • ABCDEFG
Verifier Listing
; z7_altfold: "Zig Zag". A serial validator built on an alternating fold: the
; body digits are not summed, they are added and subtracted in turn. The serial is
; seven ASCII digits, six body digits then a check digit. Starting from zero, ADD
; the first body digit, SUBTRACT the second, ADD the third, and so on, all in 8-bit
; wrapping arithmetic; the running value mod 10 must equal the check digit. The
; alternating sign is the point: a digit in an add slot and the same digit in a
; subtract slot pull the total opposite ways. To crack it, run the zig-zag fold
; over a body, take it mod 10, and append that. Technique: alternating add/subtract
; fold checksum keygen. r0 = 1 on accept; rule: nonzero.
;
; sample "246135 1": +2 -4 +6 -1 +3 -5 = 1 (mod 256), 1 mod 10 = 1 -> check 1.

        len   r2
        cmp   r2, 7
        jnz   bad           ; six body digits then a check digit

        ; every char must be a digit 0x30..0x39
        mov   r7, 0
dchk:   cmp   r7, 7
        jge   fold0
        ldb   r0, [r7]
        cmp   r0, 0x30
        jl    bad
        cmp   r0, 0x39
        jg    bad
        inc   r7
        jmp   dchk

        ; --- alternating fold of the 6 body digits into r3 -------------
        ; r4 carries the sign: 0 means add this digit, 1 means subtract it.
fold0:  mov   r3, 0
        mov   r4, 0
        mov   r7, 0
floop:  cmp   r7, 6
        jge   norm
        ldb   r0, [r7]
        sub   r0, 0x30      ; digit value 0..9
        cmp   r4, 0
        jnz   subd
        add   r3, r0        ; add slot
        mov   r4, 1
        jmp   fadv
subd:   sub   r3, r0        ; subtract slot (wraps mod 256)
        mov   r4, 0
fadv:   inc   r7
        jmp   floop

        ; --- reduce the folded byte mod 10 -----------------------------
norm:   cmp   r3, 10
        jl    final
        sub   r3, 10
        jmp   norm

        ; --- compare to the supplied check digit -----------------------
final:  mov   r7, 6
        ldb   r0, [r7]
        sub   r0, 0x30
        cmp   r0, r3
        jnz   bad

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