ARZL

ARZL is a (standard ?) compression format used for example by the secure kernel bootloader to load the non-secure kernel bootloader and the secure kernel. It is also used by /sce_sys/right/right.suprx for embedding GIM texture data.

Header
It is simply the string "ARZL" (41 52 5A 4C).

Obfuscation
The raw decompressed ARZL output is obfuscated. Although there are three versions of the obfuscation, the basic operation is the same. The obfuscation is just bit swaps as well as some deterministic changes using information from the offset.

Version 1
The only change is that the offset information is added instead of subtracted.

Version 2
Version 2 is the same as version 0 but in addition, there's an additional operation to swap two nibbles in certain conditions. The condition is found through a learning process and may be overfitted.