CRACK Solution
Polynomial Serial
CRACK CRC keygen

Prerequisites
Unlocks
02222
TechniqueCRC keygen
Rulenonzero
Sample02222
Walkthrough
Recover the accepted input below, then submit it to the CRACK verifier.
Reject Samples
- 02221
- 02223
- 02122
- 12222
- 2222
- 022220
- 0222A
Verifier Listing
; z3_crc16_keygen: "Polynomial Serial". A username and serial keygen built on a
; CRC. One valid serial per username. The serial carries the CRC of the username
; (init all ones, a reflected polynomial, eight conditional right-shift-and-XOR
; steps per byte), then a self-check. Reverse the listing, run the CRC over your
; username, format the serial. Technique: CRC keygen. r0 = 1 on accept. Accept
; rule: nonzero.
;
; 8-BIT NOTE: the source idea is CRC-16 (init 0xFFFF, poly 0xA001). The core runs
; the SAME construction reduced to CRC-8: init 0xFF, reflected poly 0x8C, the same
; eight-shift conditional-XOR inner loop, accumulator in one byte. Same algorithm
; family, same recognition cues.
;
; SERIAL FORMAT (widened so the answer is not a single brute-forceable byte): a
; five-digit serial. The first three digits are the CRC value; the last two are
; its mod-97 self-check, the same value-plus-check shape as z2_keygen_mod97. The
; username is BAKED as constants (the keygen knows the name). Keyed to "dojo"
; (0x64 0x6F 0x6A 0x6F): CRC-8 is 22, and 22 mod 97 is 22, so the one valid serial
; is "02222".
; ================= compute CRC-8 over the baked username ============
mov r3, 0xFF ; r3 = CRC accumulator (init all-ones)
; --- byte 'd' (0x64) ---
xor r3, 0x64
mov r4, 8 ; r4 = 8 shift iterations
b0: cmp r4, 0
jz b1
mov r5, r3
and r5, 1 ; low bit before shifting
shr r3, 1
cmp r5, 0
jz b0n
xor r3, 0x8C ; conditional reflected-poly XOR
b0n: dec r4
jmp b0
; --- byte 'o' (0x6F) ---
b1: xor r3, 0x6F
mov r4, 8
b1l: cmp r4, 0
jz b2
mov r5, r3
and r5, 1
shr r3, 1
cmp r5, 0
jz b1n
xor r3, 0x8C
b1n: dec r4
jmp b1l
; --- byte 'j' (0x6A) ---
b2: xor r3, 0x6A
mov r4, 8
b2l: cmp r4, 0
jz b3
mov r5, r3
and r5, 1
shr r3, 1
cmp r5, 0
jz b2n
xor r3, 0x8C
b2n: dec r4
jmp b2l
; --- byte 'o' (0x6F) ---
b3: xor r3, 0x6F
mov r4, 8
b3l: cmp r4, 0
jz crcd
mov r5, r3
and r5, 1
shr r3, 1
cmp r5, 0
jz b3n
xor r3, 0x8C
b3n: dec r4
jmp b3l
crcd: ; r3 now holds CRC-8("dojo") == 22 (0x16)
; ================= validate the five-digit serial ==================
; PPP = the CRC value, CC = CRC mod 97. For "dojo": 022 then 22 -> "02222".
len r2
cmp r2, 5
jnz bad
; every char must be a digit
mov r7, 0
dchk: cmp r7, 5
jge pp
ldb r0, [r7]
cmp r0, 0x30
jl bad
cmp r0, 0x39
jg bad
inc r7
jmp dchk
; --- parse the 3-digit primary in r6, compare to the CRC ----------
pp: mov r6, 0
mov r7, 0
ppl: cmp r7, 3
jge ppd
ldb r0, [r7]
sub r0, 0x30
mul r6, 10
add r6, r0
inc r7
jmp ppl
ppd: cmp r6, r3
jnz bad
; --- check = CRC mod 97 (subtract loop) ---------------------------
mov r5, r3
cmod: cmp r5, 97
jl havec
sub r5, 97
jmp cmod
havec: ; r5 = CRC mod 97
; --- parse the 2-digit supplied check in r6, compare --------------
mov r6, 0
mov r7, 3
cpl: cmp r7, 5
jge cpd
ldb r0, [r7]
sub r0, 0x30
mul r6, 10
add r6, r0
inc r7
jmp cpl
cpd: cmp r6, r5
jnz bad
mov r0, 1
ret
bad: mov r0, 0
ret