Guess data type

Viewed 342

I currently try to guess what data type the following raw bytes have.

25B3 E548 0200 0000 0003 BF1F D44B 217C 5440 B64E 74B6 E16B 5A40 8B54 F861 F2A9 5440 68C3 95DF C88A 5A40 1021 9EB2 16D6 5440 374D 0D3C FBAB 5A40 01C2 1815 6400 5540 D628 2EA3 4ECF 5A40

ra

It is saved in a variable called outlinePath and has something to do with shapes. The raw bytes were encoded in base64 with the NSKeyedArchiver.

I already tried a float32 array and int16. However, non of both makes sense.

This is the code I came up with. This code works fine in other parts of the dataset:

/**
 * Convert the base64 encoded float32 array to actually float32 values
 * @param buffer base64 encoded string
 */
export function convertBase64Floats(buffer: string) {
    // Decode base64
    const decodedBuffer = new Buffer(buffer, 'base64');
    // Float32 => 4 bytes
    // Get number of float values
    const floatValuesCount = decodedBuffer.length / 4;
    // New array with correct floats
    const arrayOfFloats: number[] = [];
    // Get float32s from buffer
    for (let i = 0; i < floatValuesCount; i++) {
        const offset = i * 4;
        const float = decodedBuffer.readFloatLE(offset);
        arrayOfFloats.push(float);
    }
    // Return new array of correct float values
    return arrayOfFloats;
}

export function convertInt32Array(buffer: Buffer, useBE: boolean = false) {
    const intValuesCount = buffer.length / 4;
    const arrayOfInts: number[] = [];
    for (let i = 0; i < intValuesCount; i++) {
        const offset = i * 4;
        const float = useBE ? buffer.readInt32BE(offset) : buffer.readInt32LE(offset);
        arrayOfInts.push(float);
    }
    return arrayOfInts;
}

/**
 * Convert the base64 encoded int32 array to actually int32 values
 * @param buffer base64 encoded string
 * @param useBE use readInt32BE instead of readInt32LE
 */
export function convertBase64Integers(buffer: string, useBE: boolean = false) {
    // Decode base64
    const decodedBuffer = new Buffer(buffer, 'base64');
    // Int32 => 4 bytes
    // Get number of integer values
    const intValuesCount = decodedBuffer.length / 4;
    // New array with correct floats
    const arrayOfInts: number[] = [];
    // Get float32s from buffer
    for (let i = 0; i < intValuesCount; i++) {
        const offset = i * 4;
        const float = useBE ? decodedBuffer.readInt32BE(offset) : decodedBuffer.readInt32LE(offset);
        arrayOfInts.push(float);
    }
    // Return new array of correct float values
    return arrayOfInts;
}

The same dataset also contains the variable strokePath, which looks similar. Also an array with coordinates, which is called extremePoints.

Here is a link to the full dataset, encoded as json: https://pastebin.com/sadZAvyS

The dataset represents the following shape:

enter image description here

Maybe someone with more experience with geometric shapes could explain to me, how this data structure represents the partial shape.

Edit: I just noticed, this could also be the data for just one small element in the partial shape.

1 Answers

Not yet an answer but a start:

Looking at the hexdump -c of outlinePath and strokePath, the data looks structured (not compressed) which leaves a hope to decode it :

0000000   %   ³   å   H 002  \0  \0  \0  \0 003   ¿ 037   Ô   K   !   |
0000010   T   @   ¶   N   t   ¶   á   k   Z   @ 213   T   ø   a   ò   ©
0000020   T   @   h   Ã 225   ß   È 212   Z   @ 020   ! 236   ² 026   Ö
0000030   T   @   7   M  \r   <   û   «   Z   @ 001   Â 030 025   d  \0
0000040   U   @   Ö   (   .   £   N   Ï   Z   @                        
000004a

and

0000000   %   ³   å   H 005  \0  \0  \0  \0 003 003 003 003   V   G   j
0000010   Ì   ¶   7   R   @   Æ   p   á 200   ©   l   Y   @   ¹   D   z
0000020   a   i   »   R   @   æ   ä   r  \t   ï 206   Y   @ 032   ¡ 204
0000030   q   \   9   S   @   Ê 236 204 034   $   ±   Y   @   u   e    
0000040 214   w   ¯   S   @   n   z   z   U   0   é   Y   @   §   v   y
0000050   º   i   «   S   @   -   4 217   Ì   Ü   ï   Y   @   B   ó   l
0000060   Ÿ   #   §   S   @   Ì       í   X   Ê   ö   Y   @   ª   E   Ñ
0000070  \b   š   ¢   S   @ 033   œ   :   O  \v   þ   Y   @ 023   ,   O
0000080 212   .   ,   S   @   ª   s   ²  \f 020   Æ   Y   @   Î   ·   1
0000090   G   ¹   ­   R   @   §   A 224   }   5 234   Y   @   L   K   î
00000a0   Á   t   )   R   @   p   8   Ã   0   š 202   Y   @   l   e   Ý
00000b0   =   s   .   R   @ 210   &   O   Û   +   {   Y   @   @ 237   §
00000c0   º   4   3   R   @ 035   L   Š   Ä   Ô   s   Y   @   V   G   j
00000d0   Ì   ¶   7   R   @   Æ   p   á 200   ©   l   Y   @            
00000dd

You'll notice a common 4 bytes header followed by a small number 002 or 005, 4 null bytes, either 1 or 4 times 003, and then either 8 or 26 sequences of 8 bytes all ending by a letter (T|Z|U|R|S|Y) and @.

Related