// PRXdecrypter (hacker's tool to decrypt, decompress and extract PRXs)
// version 1.8
// by jas0nuk
/////////////////

Can decrypt/decompress/extract:
* individual firmware modules from all known retail firmwares (1.00-3.73)
* updater modules from all known retail updaters
* modules and EBOOT.BIN files from all known retail games, and non-retail/testing EBOOT.BIN files
* M33 custom firmware modules
* RLZ files extracted from RCOs
* official updater DATA.PSP
* meimg.img and me_sdimg.img from 2.50+
* 2.7X~3.52 demos DATA.PSP
* 1.XX, 2.00-2.50, 2.60-2.71, 2.80, 3.00 and 3.10+ gamesharing EBOOTs
* 1.xx index.dat (encrypted form of version.txt)

///// CHANGELOG
/////////////////

1.7 --> 1.8
- Now extracts special PRXs from updater executables - open the updater with PBP Unpacker and put the DATA.PSP (renamed to whatever) in the enc folder.
 ` It will extract all the PRXs - including the hidden ones SCE didn't want us to see (they used a lame XOR encryption to hide the new ones).
 ` A lame XOR encryption was used on the usual ones, and they double-encrypted "sceLoadExecUpdater" with a scrambled header
- Overhauled filetype detection, now works with any file that has a decryption key, not just those with ~PSP in the header.
- Plain 2RLZ decompression works again
- Reduced occurence of unnecessary unsignchecking
- Returns correct unknown tag message
- Handling for double-encrypted files with scrambled headers in order to obtain the output size, such as sceLoadExecUpdater (a PRX hidden inside updaters)
- 2.xx+ game EBOOT.BIN decryption fixed
 ` note: there is a new type EBOOT.BIN floating around that this app and Aenea decrypter cannot decrypt, 
 ` if anyone comes across it, please PM me
- Added support for 1.xx (and possibly 2.00-2.50) index.dat decryption

1.6 --> 1.7
- Fully compatible with HEN/2.71/3.xx kernel/3.60 M33 - Just copy PRXdecrypter_3XX folder to GAME. Have fun, firmware modders.
 ` OE and M33 users should also use this version, just put it in GAME352 or GAME (if you have that set to the 3.52 kernel)
 ` 1.50 users (if any of you still exist) or those who want to use the 1.50 kernel, use the kxploited version.
 ` I will maintain this version in case the 3.XX kernel changes significantly which breaks PRXdecrypter
- Added 3.60 and 3.7X keys
- HEN/3.XX version doesn't need sysmem_rlz.prx for RLZ decompression as it uses the function from the 3.xx kernel
- Huge internal cleanup with clearer messages, better error handling and more speed.
- Improved logging (logs almost everything now)
- Press O to UnSignCheck all files in the ms0:/enc folder
- Press RIGHT on the D-PAD to extract reboot_02g.bin from loadexec_reboot_02g.prx (from 3.60 or higher)

1.5b --> 1.6
- Now comes with a HEN compatible EBOOT which doesnt seem to work properly (partially broken on 3.xx kernel on the fat PSP, 
 ` completely broken on 3.60 M33 due to new hardware)
- Added 6 more key sets (1.XX, 2.00-2.50, 2.60-2.71, 2.80, 3.00 and 3.10+ gameshare keys)
- Now press TRIANGLE rather than HOME to exit
- Fixed 2.7X demo decryption (wrong key)
- Removed 5 useless keys
- Now uses the entire buffer - previously, files over 4mb would fail
- Added second layer of descrambling to a few files - this would have produced messed up output if you tried in the old version

1.5 --> 1.5b
- Added decryption for:
 ` 1.XX game EBOOT.BIN files
 ` New game EBOOT.BIN types which aren't yet being used (4 different keys)
 ` A few unknown filetypes (keys found in mesg_led)
 ` DATA.PSP from 2.7X, 2.8X and 3.XX demos (4 different keys)
 ` DATA.PSP from official updaters
 ` 2.50/2.60 meimg.img and me_sdimg.img (2 different keys)
- NOTE: If you want to decrypt a file, make sure it has the 4 byte "~PSP" header, or it will be skipped by the decrypt function.
 ` You can easily add this using a hex editor.
- Better checks before attempting to "UnSignCheck" files
- Fixed an incorrect error message
- Fixed a logging bug which logged "fail" and "success" at the same time
- Increased buffers to 10mb each to allow large files to be decrypted

1.4b --> 1.5
- More source cleanup and improved error handling: If something fails to decrypt or decompress it saves as much as possible,
 ` or avoids saving to prevent memory stick corruption. (No more deletion of files for no reason)
- Can decompress plain 2RLZ files in the ms0:/enc folder (extracted from RCOs or whatever)
- Improved method of initializing 2RLZ decompressor - much faster now, and less likely to fail
- Now writes a log of all activities to ms0:/enc/log.txt
- Fixed a bug which prevented the header of extremely small files (less than 208 bytes) being found
- FINALLY: retail game EBOOT.BIN decryption
- Improved M33 PRX detection to reduce false positives
- SHA-1 check removed to allow files such as vshmain.prx from 3.5X to decrypt

1.4 --> 1.4b
- M33 decompression fixed; no longer interferes with official PRXs
- Source cleanup

1.3 --> 1.4
- Decompresses PRXs from M33 custom firmware
- Improved error handling
 ` Already decrypted files are skipped
 ` Files with unknown headers are skipped
 ` Files that produced odd output are deleted to prevent memory stick corruption
- Improved path handling (hopefully no more strange "Unable to open file" problems)

1.2 --> 1.3
- 3.30 support

1.1 --> 1.2
- 3.10/3.11 support
- changed name

1.0 --> 1.1
- Supports sigchecked files if they were signed on the PSP they are being decrypted on
- Can decompress RLZ files
- "sysmem_reboot.prx" is now "sysmem_rlz.prx" as it is used for both reboot.bin extraction and RLZ decompression.
 ` If "sysmem_rlz.prx" is not in the 'enc' folder, a red warning will be displayed and RLZ decompression will not be possible.
- Much better error handling. Note: if a file entirely fails to decrypt (e.g. EBOOT.BIN) it will be deleted to prevent memory stick corruption.
- To save space, paths are printed as just the filename, e.g 'audio.prx' instead of 'ms0:/enc/audio.prx' whilst decrypting

///// INSTRUCTIONS
////////////////////

Make a folder on your memory stick called "enc" and place your encrypted or compressed files there.

Run the app and press X to decrypt them, or O to unsigncheck them only (making them generic encrypted files).
The encrypted/compressed files will be replaced with decrypted/uncompressed/extracted versions.
Files can only be unsignchecked on the PSP they were signchecked on.
The maximum file size that can be decrypted or decompressed is 10mb due to limitations of the hardware and buffering method.
In future versions I may increase this to ~25mb for Slim hardware.

To extract updater modules, place an *encrypted* DATA.PSP from an official updater in the enc Folder. Press X to decrypt all files as usual.
The modules will be decoded (if necessary) and saved to the 'updaterprx' folder which will be made automatically.
If you are extracting modules from multiple updaters, the first updaterprx folder will be renamed to updaterprx_0000, then updaterprx_0001, and so on.

The HEN/3.xx version will not run on the 1.50 kernel, and the 1.50 kernel version will not run on the 3.xx kernel.
If you run the wrong version for the kernel you are using, the application will exit.

The app can also extract reboot.bin from a 1.50 loadexec.prx or later, and reboot_02g.bin (for the Slim hardware) from 3.60 loadexec.prx or later:
1. *If* using the 1.50 kernel version, place a decrypted 2.70 or later sysmem.prx in the "ms0:/enc" folder and name it as "sysmem_rlz.prx"
 ` There can be problems using sysmem.prx from 3.30 or higher, so it's more reliable to use one from 2.70.
 ` This is not necessary using the HEN/3xx version, as the firmware already contains the RLZ decompression routines.
2. Place a decrypted copy of loadexec.prx from the firmware you want reboot.bin for, and rename it to "loadexec_reboot.prx"
3. For reboot_02g.bin, get a decrypted 3.60+ loadexec.prx and rename it to "loadexec_reboot_02g.prx"
When these files are detected, an option to obtain reboot.bin (by pressing SQUARE) or reboot_02g.bin (by pressing RIGHT on the D-PAD) appears in the menu.

Press TRIANGLE to exit PRXdecrypter.

///// THANKS
/////////////////

Everyone at malloc/lan.st/dark-alex.org/exophase
Dark_AleX - for unsigncheck, for SE/OE/M33, and for various decryption keys
Team Noobz/C+D - for 3.00~3.52 encryption keys
PspPet for the original psardumper
SilverSpring for various pieces of info about keys and decryption
Chilly Willy for excellent 3.xx code examples and automatic folder renaming


Enjoy ;)

~jas0nuk
