Bootloader

On the vita there are several bootloaders (stage bootloaders).

One (or probably 2 stages boot) is used to boot to the TEE (Secure world) and one to load the kernel in the normal world.

Some bootloaders are obfuscated via ARZL algorithm.

= SLB2 Image =

SLB2 is the format used to store the encrypted bootloaders on the device.

ENC Files
The last 0x340 bytes is a footer that likely contains a signed MAC of the plaintext data.

= ARZL =

ARZL is a (standard ?) compressed format which is used by the secure bootloader to load the non-secure bootloader and the secure kernel.

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.