I am trying to de-compress file that was compressed with unknown algorithm.

I am pretty new in this area. I read about algoirthm such LZ 77, 78, LZW, LZRW 1, etc.

I need to find the algorithm.

Here is the file:

https://ufile.io/648r6

The extension of the file is:

I am not sure if this is kind of clue.

This is a compressed PNG file.

I think they are using some kind of LZRW 1, I am not sure.

I succeed to de-compress the IHeader of the file correctly (I verified it with CRC).

This the comparing between them:

This is the algorithm I noticed it worked with:

There is a 1 byte flag every each 8 bytes.

If the flag is > 0 I am checking its bits.

For example:

08 (0000 1000)

00 00 02 58 (00 83) 5A 08 06

The flag is 08 => 0000 1000

So it need to go 5 step forward after the flag => 00 83 ....

The dictionary looks to be built by 2 bytes, for example: 00 83

In binary:

0000 0000 1000 0011

The first 4 bits from the right are might be the length and the rest (12 bits) are probably the absolute offset.

offset length

(0000 0000 1000) (0011)

Check again the the picture of the above algorithm if you still didn't understand.

I wrote decompress algorithm according to the above picture, every 8 bytes checking the flag, if its != 0, I am going to the index it point on and take the length and the offset according to what I wrote.

The problem is that it worked for me only on the first chunk, on rest (IDAT) it didn't work.

I looked to the next flags after the first chunk dictionary (0x0 0x83) and saw a new dictionaries (0x9 0x84):

My algorithm takes the 0x98 as the offset and 0x4 as the length.

Maybe there is something else that the 0x9 is response to.

I tried to calculate it in any way like that:

0x9 + 0x8, 0x9 | 0x8 and etc.

I don't see the pattern.

This is the "best" result I received with my algorithm:

My algorithm:

Any idea ?Code:Algoritm pesudo code: data = readFile(filePath) i = 0 while i < len(data): controlbits = data[i] // controlbits is 8 bites i += 1 for bit in controlbits: if bit == 0: output += data[i] i += 1 else: // bit is 1 // Example: data[i] = 0x0, data[i+1] = 0x83 // data[i] = 0000 0000 // data[i+1] = 1000 0011 // dict = 0000 0000 1000 0011 dict = data[i] << 8 dict |= data[i+1] offset = dict[0:12] len = dict[12:16] output += output[offset: offset+len] i += 2