Small MV Game: The Secret Password - MV data encryption

Here's a little game I put together. 


Briefing


Start by taking a look at this demo: http://himeworks.com/demo/SecretPass/


Upon starting the game, you'll see a title screen with three options. The usual MV fare.


When you enter the game, you'll see one NPC in the middle of nowhere.


Speak to him, and he'll provide you with some information about what's going on.


Take note of his face and sprite.


Once you've spoken to him, you can close the game since that's all there is to it.


Objectives


The game doesn't take place inside the MV demo. Rather, it takes place in the project files.


Here is a link to all of the files in the project: https://github.com/HimeWorks/The-Secret-Pass


In my project, I have hidden a secret image that contains a password that will lead to fame and fortune.


The location of the password has already been discovered: https://github.com/HimeWorks/The-Secret-Pass/blob/master/img/pictures/secret.png


All you have to do is open it in a tool that can read images (such as a browser, or paint), and look at the message.


However, it looks like it has been protected somehow.


Let's take a look at some of the other images, which were used in the demo.


https://github.com/HimeWorks/The-Secret-Pass/blob/master/img/faces/Actor1.png


https://github.com/HimeWorks/The-Secret-Pass/blob/master/img/characters/Actor1.png


None of them seem to work. Is it a browser issue?


Here's another image.
https://github.com/HimeWorks/The-Secret-Pass/blob/master/icon/icon.png


This one seems to work fine.


What's going on?


Your goal is to find a way to load the "secret" image, using any techniques you're familiar with!



Let me know if you figure out the secret to fame and fortune!


Note that this is the first time I'm creating a puzzle, so I'm not sure how many hints I should give.


Hints


What is the problem?

Spoiler
There's a picture called "secret", but you can't read it using normal means.


If you try to open it in your browser or an image editor, it will not load.


However, it is a valid image.


The problem here is the image has been encrypted, and that information is not publicly known at this point.


The purpose of me encrypting the image is because, of course, it is a secret!



How do I solve the problem?

Spoiler
There are two general solutions that I can think of when it comes to this problem.


- The first way is to the most direct way: figure out what the encryption is, and then decrypt it. This will likely require programming knowledge.


- The second way is to think about what you just saw in the demo. Programming knowledge is not required for the method I'm thinking of.


There may be other solutions which I'm unaware of, so if you have a technique you'd like to share let me know!



What is the secret password?

Spoiler
Spoiler




That'a a secret! You'll know when you successfully open the "secret" image.


The only way to find out is to open the image. It isn't available anywhere else.


But if you really want to know the secret to life...
@SwiftIllusion figured it out already http://forums.rpgmakerweb.com/index.php?/topic/61088-small-mv-game-the-secret-password-mv-data-encryption/&do=findComment&comment=591351
Urgh... This is hard... I've tried opening it in notepad, GIMP, paint, I tried opening it with 7zip, nothing! Hime, it's really hard... I shall find this secret though!!


Maybe using MV would work... I'll keep trying!
im not sure if im doing it wrong or something is missing but im getting this message erm....seems you need to high light the font...cant change colour cuz i dont know how >.>


  [Exception... "Component is not available" nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)" location: "JS frame :: http://himeworks.com/demo/SecretPass/js/main.js :: Graphics._paintUpperCanvas :: line 45" data: no]


see
Maybe that's a clue Balako!! Maybe the js folder has the key, gotta keep looking!
but she said we have to talk to an npc >.>


@Tsukihime is the password "master" ??
but she said we have to talk to an npc >.>


@Tsukihime is the password "master" ??



Nope.


Though I'm curious how you worked that out
opened the picture with view picture, they gave me the location...i didnt see master on folders path so i assumed its extra and could be the password >.>


omg "you are being" ????  @Tsukihime


i think this is a part of it ...
opened the picture with view picture, they gave me the location...i didnt see master on folders path so i assumed its extra and could be the password >.>


omg "you are being" ????  @Tsukihime


i think this is a part of it ...



The secret word is inside the "secret.png" file lol
When you successfully open it, the secret will be revealed.
😀 got it, that was pretty neat and tricky 😀.
 

Spoiler
Pear
this darned squirrel!!!
😀 got it, that was pretty neat and tricky 😀.
 

Spoiler
Pear



Well, that didn't take too long to circumvent. Now we know what not to use for data protection lol
i have no idea how he got that result, i tried to open all pictures with TXT xD
H-h-ow?!? Also weshould have known all along it would be REDACTED.
H-h-ow?!? Also weshould have known all along it would be REDACTED.

Hey, I resemble that remark!
Didn't look int it yet, but I suppose it should be easy to find the key by looking at the scripts, it needs to be somewhere, right?


I was just talking about something like this today on an status update, but I'll use a key that can't be found. Did you see any performance loss by opening an encrypted file instead of a regular one?
ok i give up, it has nothing to do with opening picture in text U.U
Didn't look int it yet, but I suppose it should be easy to find the key by looking at the scripts, it needs to be somewhere, right?


I was just talking about something like this today on an status update, but I'll use a key that can't be found. Did you see any performance loss by opening an encrypted file instead of a regular one?



I have not noticed any performance issues, because all of my images are small (ie: average 50-100 K😎.


However, I think javascript is fast enough to process several MB in fractions of a second (ie: audio), so it shouldn't be that big of a deal.


The key can be generated, so that people will be looking for the routines that generate the key.


The key can be loaded from a remote server as well so that even if you know the algorithm, you can't do much with it unless you intercept the key.


But as far as this specific project is concerned, it's pretty easy to figure out the secret if you know what you're doing.

ok i give up, it has nothing to do with opening picture in text U.U



Nope, you won't get anything there lol


Have to get more creative!
Not quite hard to find this

Spoiler
https://en.wikipedia.org/wiki/PK3_(file_extension) FYI



 




Code:
var Imported = Imported || {},
    TH = TH || {};
Imported.TH_XOREncryption = 1;
TH.XOREncryption = TH.XOREncryption || {};
(function(a) {
    a.decrypt = function(a) {
        for (var b = 0; b < a.length; b++) a[b] ^= 255;
        return a
    };
    var b = Bitmap.load;
    Bitmap.load = function(c) {
        if (c.contains("img/")) {
            var d = new Bitmap,
                e = new XMLHttpRequest;
            e.open("GET", c);
            e.responseType = "arraybuffer";
            e.onload = function() {
                if (400 > e.status) {
                    data = a.decrypt(new Uint8Array(e.response));
                    var b = new Blob([data], {
                            type: "image/png"
                        }),
                        b = URL.createObjectURL(b);
                    d._image = new Image;
                    d._image.src = b;
                    d._image.onload = Bitmap.prototype._onLoad.bind(d);
                    d._image.onerror = Bitmap.prototype._onError.bind(d);
                    d._url = b
                }
            };
            e.onerror = function() {
                DataManager._errorUrl = DataManager._errorUrl || c
            };
            e.send();
            d._isLoading = !0;
            return d
        }
        return b.call(this, c)
    }
})(TH.XOREncryption);
Not quite hard to find this

Spoiler
https://en.wikipedia.org/wiki/PK3_(file_extension) FYI



  Hide contents









var Imported = Imported || {},
TH = TH || {};
Imported.TH_XOREncryption = 1;
TH.XOREncryption = TH.XOREncryption || {};
(function(a) {
a.decrypt = function(a) {
for (var b = 0; b < a.length; b++) a ^= 255;
return a
};
var b = Bitmap.load;
Bitmap.load = function(c) {
if (c.contains("img/")) {
var d = new Bitmap,
e = new XMLHttpRequest;
e.open("GET", c);
e.responseType = "arraybuffer";
e.onload = function() {
if (400 > e.status) {
data = a.decrypt(new Uint8Array(e.response));
var b = new Blob([data], {
type: "image/png"
}),
b = URL.createObjectURL(b);
d._image = new Image;
d._image.src = b;
d._image.onload = Bitmap.prototype._onLoad.bind(d);
d._image.onerror = Bitmap.prototype._onError.bind(d);
d._url = b
}
};
e.onerror = function() {
DataManager._errorUrl = DataManager._errorUrl || c
};
e.send();
d._isLoading = !0;
return d
}
return b.call(this, c)
}
})(TH.XOREncryption);











I thought I had hid it pretty well. I even concat all the scripts together 🙁
if this is part of the solution then i should just walk away @. @

Original thread: https://forums.rpgmakerweb.com/threads/small-mv-game-the-secret-password-mv-data-encryption.61088/