Hey guys, I just made a little nifty but small program that converts binary data into images.
I mainly just created it out of curiosity of what a program would look like as an Image.
And the results are quite interesting. (Images at the very bottom).
Now this made me come up with the idea that this might can actually be used to save your game data as well,
each color is obviously made up from 3 sets of binary data (Red, Green and Blue), change any of them values and you have a broken set of data completely.
Now obviously this may not be a perfect solution, but it makes me wonder how good it may actually be.
⦠The reason I think it may be kind of secure is because as mentioned above, each pixel would relate to 3 different binary values, change a pixel to any other color to try and adjust it and cheat, might break it.
The way I have it designed it would break it, no matter what way you try and put it because no matter what it takes 3 bytes to create the needed pixel value. So 1 or 2 of the bytes may be part of ā=ā for example for a float or bool or int, so adjust the values wrong and you have health - 5; instead of health = 5;
Now this isnāt to say this is perfect, or any better than anything else, but I just thought this was interesting, and wonder if this would be good for saving data, I mean itās certainly more secure than plain text, and certainly more secure than pure binary, but itās still I know of course not unhackable.
Props for thinking outside the box and trying to find weird uses for image formats. I always like that. But I donāt quite see the point. What does that solve that encryption doesnāt solve, and is it worth solving in the first place? Personally I see no reason to not just save stuff as plaintext. If someone wants to cheat because they have fun with it, let them. Achievements are meaningless anyway, and I know no game with a highscore list that doesnāt have cheated entries (except maybe Devildaggers because there highscores get submitted with replays and I think they just delete all that donāt look legit).
@Martin_H That is a very valid point, I wasnāt thinking of it replacing encryption, just a way to mask the data. just a small step to hide the data from wanna-be hackersā¦
Example if itās saved in like (Project/Images/Preview.jpg) most people wouldnāt think anything of it, theyād just think it was weird looking imageā¦
Not really an encryption, just a small, little extra annoyance to wanna-be hackers.
But honestly I didnāt create this for this intention, it was just an idea after I created it. Quite an interesting one as well lol.
Its in no way perfect, and doesnāt replace better solutions, (I donāt think). Maybe people know more about pixel data than I do, I just thought it was cool haha.
THe problem here is that UNity doesnāt have raw image manipulation classes that are not tied to textures. And the textures are hardware dependent.
Dumping data into images is nothing unusual - it is pretty much the same thing as a normal data container, as long as youāre using something like PNG.
IN addition to that there were multiple games that stored saves in *.png file metadata. An example of those were Spore games, which stored creature parameters somewhere within the file, I believe.
Also⦠beware of lossy compression data formats.
By the way, if you really feel like it, you could encode your save into a QR Code or similar marker. This will make it readable with a smartphone.
@neginfinity Ah man I completely forgot Unity didnāt have such stuff, guess I kinda assumed that the new .net in Unity would have it, suppose not.
I hadnāt realized many people stored data in Images, pretty interesting. Hmm never even studied how QR Codes worked, I may study it up one day, thanks for the info mate.
If you save it as an actual jpg itās already broken because reading it again you get ever so slightly different pixels back.
I would assume they love that kind of stuff.
Thatās something I could see being useful for something.
I would suggest to store data in bmp images that makes sense for people to edit them with paint or something similar. Imho making it easier to edit is a better reason to store stuff as images, than trying to make it harder. E.g. Iāve experimented with storing colored pixels for spawn-points in tiny 256x256 pixel image files. Works fine if you donāt need too many diferent layers and states. Such a bare-bones ālevel editorā could be cool for people to have. The savegame thing seems rather pointless to me.
It reminds me of the time when I had to do a contract work at a place where they had unreasonable security measures. I was forbidden to take my own source code outside, even for a personal reference. They blocked the whole internet (if I had some programs I need, I had to ask them to dowload them for me) and even checked the whole file system for source codes or archieves that might contain them when people leave that place.
So I wrote a similar program to take bunch of source code and encode them as bitmap image files. I didnāt actually use that program though, because I wasnāt sure if it wouldnāt be a trouble later and concluded those source code were not worthy enough to justify all the hassle.
@Martin_H : Well as I mentioned I wasnāt even making it for this intention, I just thought it was cool with the results of getting data into an Image lol. Well now I know itās not exactly useful for Unity case, thatās partially why I wanted all your opinions on it before even trying to make it for this.
It was just a fun little project I made in a couple hours.
By the way, not sure if youāre familiar with it, but in ZX-spectrum era it was not uncommon to load executable code into screen area. Spectrum had 64 ram total, and the screen took quarter of it. So, during loading phase of the game, some games set the color attributes to āblack foreground, black backgroundā, loaded machine code into the screen area and ran it to perform some sort of setup in other part of the memory. If the game failed to āpaint the screen blackā for some reason, you would see the āsnow patternā filling the screen.
Thatās pretty cool! Never played them games and such before, I was roughly 4 when I got my hands on an Atari (1992) and thatās the oldest Iāve gone back⦠Always wanted to try the older platforms, but thatās pretty cool, do you know how expensive this old hardware is online? If itās anything like an original NES costing 10,000 dollars brand new in a box then itās out of the question for me haha.
I believe you can buy clones for cheap. Nes clone should be easy enough to find (china makes ton of them), spectrum clone⦠well, spectrum clones are usually DIY kits.
Also, I see ton of spectrums on ebay. The price is a bit steep, but not $10000 for sure. Same goes for nes. If you REALLY wnat the original hardware and donāt mind messing with analog connection, you could get a used/refurbished one.
Pretty common way to pass non-image data to a shader. I have one shader that colors the areas on a map using various data values stored in the RGBA channels of a 128x1 bitmap. Another input texture acts as the āreference mapā with each area in a different color that defines the lookup location in the data texture.