Skip to content

Instantly share code, notes, and snippets.

@Fortyseven
Last active January 31, 2025 02:41
Show Gist options
  • Save Fortyseven/13a83675215786fcb45e3fec0d8d46b1 to your computer and use it in GitHub Desktop.
Save Fortyseven/13a83675215786fcb45e3fec0d8d46b1 to your computer and use it in GitHub Desktop.
ImageScribber.md

Just gonna toss down some stuff I noted; it may be obvious and already known, but whatevs. Maybe some of this will inspire an idea.

Focusing on ImageScribbler mostly, and assuming the existing byte order (though reversing it was tried).

Referring to bits I'll be like 7654 3210 (e.g. 'bit 7' is the first).

  • Everything past the first 16 bytes is identical.
  • Doesn't look like bytes are 1:1, what I mean is 96 36 are both b.
  • The second nibble is most commonly 6 (0110) in the range with text, but the second bit is always 1.
  • 04 feels like some kind of NULL, but it appears in the text area of "Golden Software", so clearly not...

What I tried with no luck:

  • straight ASCII (obviously not gonna fly)
  • XOR brute force
  • endian swapping
  • bit rotations
  • stripping the lower bits, shifting the rest right and then stringing the whole thing together
  • cramming it through Deekseek/ChatGPT/Llama3 and praying
7654 3210
---- ----
1011 0110  I    B 6
1001 0010  m    9 2
1110 0110  a    E 6
1000 0110  g    8 6
1100 1010  e    C A
1010 0110  S    A 6
0100 1110  c    4 E
1100 0110  r    C 6
0100 0110  i    4 6
1001 0110  b    9 6 
0011 0110  b    3 6 // different 'b'
0100 0110  l    4 6
0100 1111  e    4 F  
1010 0110  r    A 6 
=========       ===
0000 0100       0 4
1010 0111       A 7 
0000 0100       0 4 
0000 0100       0 4 
0000 0100       0 4 
0000 0100       0 4 
0000 0100       0 4 
0000 0100       0 4 
0000 0100       0 4 
0000 0100       0 4 
1010 1100       A C 
0000 0100       0 4 
1000 1100       8 C 
1111 0100       F 4 
0001 1100       1 C 
1111 0100       F 4 
0101 1010       5 A 
1110 1101       E D

7654 3210
---- ---- 
1111 0110 G F6 
1110 0010 o E2 
0010 0110 l 26
0011 0110 d 36
0111 0110 e 76
1010 0110 n A6
1100 1010 _ CA  // space
0000 0100 S 04  // ?!!
0110 0110 o 66 
1111 0110 f F6 
1110 1110 t EE 
0010 1110 w 2E 
0100 1110 a 4E 
1000 0110 r 86
0000 0100 e 04  // ?!!
[rest omitted]

For reference:

15 bytes
G  o  l  d  e  n  _  S  o  f  t  w  a  r  e 
F6 E2 26 36 76 A6 CA 04 66 F6 EE 2E 4E 86 04|A7 04 04 04 04 04 04 04 04 AC 04 8C F4 1C F4 5A ED
1  2  3  4  5  6  7  8  9  10 1  2  3  4  5  6  7  8  9  20 1  2  3  4  5  6  7  8  9  30 1  2

14 bytes
I  m  a  g  e  S  c  r  i  b  b  l  e  r
B6 92 E6 86 CA A6 4E C6 46 96 36 46 4F A6|04 A7 04 04 04 04 04 04 04 04 AC 04 8C F4 1C F4 5A ED
1  2  3  4  5  6  7  8  9  10 1  2  3  4  5  6  7  8  9  20 1  2  3  4  5  6  7  8  9  30 1  2
@Fortyseven
Copy link
Author

Fortyseven commented Jan 31, 2025

(Not mine; pulled off of the Discord.)

def bit_reverse(i, n):
    return int(format(i, '0%db' % n)[::-1], 2)

def hex_to_ascii(hex_input):
    byte_pairs = [hex_input[i:i + 2] for i in range(0, len(hex_input), 2)]

    sorted_bytes = []
    i = 0
    while i < len(byte_pairs):
        sorted_bytes.append(byte_pairs[i + 1])
        sorted_bytes.append(byte_pairs[i])
        i = i + 2
    result = []

    for byte_pair in sorted_bytes:
        byte = int(byte_pair, 16)
        print(f'h: {byte_pair} - {byte:b}')
        end_of_string = (byte >> 0) & 1
        lowercase_flag = (byte >> 2) & 1
        numeric_flag = (byte >> 3) & 1
        char_offset = byte >> 3
        char_offset = bit_reverse(char_offset, 5)

        if char_offset == 0:
            char = " " # special case, space
        elif lowercase_flag:
            char = chr(ord('a') + char_offset - 1)
        else:
            char = chr(ord('A') + char_offset - 1)
        # TODO: numbers, other mac roman stuff

        result.append(char)
        if end_of_string:
            break
    return ''.join(result)

#hex_input = "F6E2263676A6CA0466F6EE2E4E8604A7"
hex_input = "B692E686CAA64EC6469636464FA604A7"
ascii_output = hex_to_ascii(hex_input)

print("Decoded ASCII String:", ascii_output)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment