CRACK Solution

FLIP THE NIBBLES

CRACK nibble swap

In-game screenshot of FLIP THE NIBBLES
In-game view
FamilyCRACK Graph0.233 DifficultyEasy Ring02 IDg12_easy4

Prerequisites

SPIN COUNT

Unlocks

GATE TRAIN

Accepted input REVERSE
Techniquenibble swap Rulenonzero SampleREVERSE

Walkthrough

Seven bytes. The check swaps the high and low nibble of every char (rol 4) before comparing. Swap the targets back and read it off.

Nibble swap: rol r,4 trades the two 4-bit halves and is its own inverse, so swap each target's nibbles to decode.

Hints

  • HINT 1: Seven bytes. The rol r0, 4 spins each byte by half a byte before the compare.
  • HINT 2: A nibble swap undoes a nibble swap. Just swap the two hex digits of each target.
  • HINT 3: 0x25 0x54 0x65 0x54 0x25 0x35 0x54 swapped is 0x52 0x45 0x56 0x45 0x52 0x53 0x45.

Reject Samples

  • REVERS
  • REVERSES
  • reverse
  • REVEDSE
Verifier Listing
; g12_easy4: nibble swap. Each input byte has its two 4-bit nibbles swapped
; (rotate left by 4) and matched against a stored target. Technique: nibble swap
; (rol r,4). The swap is its own inverse, so swap each target's nibbles to decode.
; r0 = 1 on accept. Accept rule: nonzero. Seven bytes long.
;
; targets = 0x25 0x54 0x65 0x54 0x25 0x35 0x54  ->  password "REVERSE"
;   'R'(0x52)->0x25, 'E'(0x45)->0x54, 'V'(0x56)->0x65, 'E'(0x45)->0x54,
;   'R'(0x52)->0x25, 'S'(0x53)->0x35, 'E'(0x45)->0x54

        len   r1
        cmp   r1, 7
        jnz   bad           ; exactly 7 bytes

        mov   r7, 0
        ldb   r0, [r7]
        rol   r0, 4
        cmp   r0, 0x25
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        rol   r0, 4
        cmp   r0, 0x54
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        rol   r0, 4
        cmp   r0, 0x65
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        rol   r0, 4
        cmp   r0, 0x54
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        rol   r0, 4
        cmp   r0, 0x25
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        rol   r0, 4
        cmp   r0, 0x35
        jnz   bad
        inc   r7
        ldb   r0, [r7]
        rol   r0, 4
        cmp   r0, 0x54
        jnz   bad

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