Decryption on PNG files

asnaz

Newbie
Feb 6, 2018
92
92
Hi there. So recently i ve been looking some games that meets with my taste in japanese to do a MTL translation than edit them but some game files are encrypted in terms of the PNG file format. They can't be opened or prewieved. Are there any tools out there that decryptes encrypted .PNG files? Here is a example; 1639912995556.png
 
  • Like
Reactions: kokuou_jyn

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,254
Unfortunately, it's got nothing to do with the .png files.

The thing that makes the difference is the game engine. In this case, .

With a very common game engine, like RPGMaker VX/MV, etc - there's a good chance someone already figured it out. But something as specific as this one, I think you're going to be struggling (I have spent about 15 minutes searching various search terms unsuccessfully).

Sometimes you can get lucky. Some game engines, like Visual Novel Maker, just do a basic math operation on each byte of the file. Once you realize that all .png files start with ëPNG, it's usually pretty easy to figure out what has been done to mess with the files.

A standard PNG header...
pnghex01.jpg

What your files have...
pnghex02.jpg

Now that "enc.D" at the beginning is encouraging (well, maybe only the "enc" part - since it hints at a standard file format).
But it clearly ISN'T directly linked to a standard png header.

The other good news is that the JS code isn't encrypted. So it's possible that the actual decryption code is viewable. But if it is, I couldn't find it (which isn't surprising, as I barely know what I'm doing here). I managed to track things back to a function that uses the Cocos2D loadImg() function... but I may be on completely the wrong path.

Whilst none of that answers your question, I'm hoping that it's enough of a nudge in the right direction for someone else to sweep in with a better answer.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,862
16,009
To 79flavors answer have to be added the specific case of Ren'Py games. It don't concern the present case, but it's a frequent question so I might as well answer it in this thread with such explicit name.

Ren'Py have the particularity to not care about the file extension for the images. You can have a "myImage.ThisExtensionIsWeirdYouKnow" file, if you ask Ren'Py to treat it as an image, it will open it, and find it's format through the signature at start of the file.
This mean that most of nowadays Ren'Py games, especially their compressed versions, have images using the "jpg" or "png" extension, but being in fact in the "webp" format. Since this format is relatively new, there's high chance that your OS/software don't know how to deal with it, what will make you think that the images are encrypted.

To solve this issue you've to add WEBP support to your OS ( , Linux ( , , ), ).

Edit: typo
 
Last edited:
  • Like
Reactions: Rich

xj47

Member
Nov 4, 2017
241
408
Like 79flavors said, the encryption is engine specific. There is no general "png" encryption
It's also possible that the actual images aren't PNGs at all - but I doubt that. People usually don't do cute stuff like that

If you link me some games that use this engine I can take a look at it.
Reverse-engineering encryption schemes can be kinda fun.
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,254
If you link me some games that use this engine I can take a look at it.
Reverse-engineering encryption schemes can be kinda fun.

I did think of you when I saw this post, but didn't like to drag you into it.

Via the image he included, I found the game was called "Erozld". I found a torrent version of it and downloaded it.
It's how I figured out the game engine was "Pixel Game Maker MV".
I'll be deleting it shortly, as the only reason for grabbing it was to diagnose this question. It's really not my sort of game.

My assumption was that he's correct that the image files are encrypted, as that was a feature added to PGM-MV... though obviously now that I'm looking for it... I can't find the damned changelog that says so.

Btu since you asked... Find 3 .png files from the game attached.


To come back to a previous point too...

As Anne says... RenPy does things a little differently. It (partially) ignores the file extension and (I assume) instead looks for these sort of "header" bytes at the beginning of each file and uses them to figure out what the file format actually is. It's why you'll see "compressed" versions of RenPy games where the files are all named as if they are .jpg or .png files, but are in actual fact they are (much smaller) .webp images.

In this case though, the files aren't .webp as far as I can tell. According to , .webp files start "RIFF/WEBP", like this example...
webphex03.jpg

But knowing RenPy ignores that sort of crap can be handy when the operating system won't open the file and you want to find out if the file is another format and just named wrongly.
 
Last edited:

dust47

New Member
May 15, 2021
6
0
Here's a python script for decrypting files from Pixel Game Maker MV games, or at least ones that use the same engine version as RJ359093
I tried to decrypt RJ340350 using DecryptPGM_MV, but it failed to decrypt. What should I do?
 

xj47

Member
Nov 4, 2017
241
408
I tried to decrypt RJ340350 using DecryptPGM_MV, but it failed to decrypt. What should I do?
I can take a look at the files and see if adjustments need to be made to the tool. Is there a link I can download the RJ340350 files at?
 

xj47

Member
Nov 4, 2017
241
408
I can' t see the link because I get the following message.

Oops! We ran into some problems.
You do not have permission to view this page or perform this action.
ya, the post says it's awaiting approval before being visible. I thought that would only take a few hours but now it's been over 16 > _ >
Here's the file. It has a readme.txt that explains how to use it
 
  • Like
Reactions: gojira667

dust47

New Member
May 15, 2021
6
0
ya, the post says it's awaiting approval before being visible. I thought that would only take a few hours but now it's been over 16 > _ >
Here's the file. It has a readme.txt that explains how to use it
Decryption of RJ340350 was successful.Thank you.
I also tried to decrypt RJ300168, but it failed, and the debug log stopped at the line "(0/1438) Resources/audio/bgm001.ogg".
I tried the old extractor, but it failed too.
 

xj47

Member
Nov 4, 2017
241
408
Decryption of RJ340350 was successful.Thank you.
I also tried to decrypt RJ300168, but it failed, and the debug log stopped at the line "(0/1438) Resources/audio/bgm001.ogg".
I tried the old extractor, but it failed too.
Gah.
I'll take a look at that one as well when I have the time & energy
 

xj47

Member
Nov 4, 2017
241
408
Decryption of RJ340350 was successful.Thank you.
I also tried to decrypt RJ300168, but it failed, and the debug log stopped at the line "(0/1438) Resources/audio/bgm001.ogg".
I tried the old extractor, but it failed too.
Fix was a lot easier than expected.
Here's an updated version that should work for a lot more games
 

OkiDuki

New Member
Dec 6, 2022
1
0
Fix was a lot easier than expected.
Here's an updated version that should work for a lot more games
I just successfully used your extraction tool to extract the assets from the game "Rabbit Hole" :) Thank you so much for providing this!
 

coffeeaddicted

Well-Known Member
Apr 13, 2021
1,812
1,474
To 79flavors answer have to be added the specific case of Ren'Py games. It don't concern the present case, but it's a frequent question so I might as well answer it in this thread with such explicit name.

Ren'Py have the particularity to not care about the file extension for the images. You can have a "myImage.ThisExtensionIsWeirdYouKnow" file, if you ask Ren'Py to treat it as an image, it will open it, and find it's format through the signature at start of the file.
This mean that most of nowadays Ren'Py games, especially their compressed versions, have images using the "jpg" or "png" extension, but being in fact in the "webp" format. Since this format is relatively new, there's high chance that your OS/software don't know how to deal with it, what will make you think that the images are encrypted.

To solve this issue you've to add WEBP support to your OS ( , Linux ( , , ), ).

Edit: typo
I did a check on Google and it seems you can install the codec from them.