encrypting pictures..

Started by Apidcloud, May 08, 2011, 11:45:09 am

Previous topic - Next topic

Apidcloud

Hey :P
I want to learn how to encrypt my pictures, then read them with rgss XD

There's any way to do that?

I really need this because I want to make projects(rmxp for example) more secure :P
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

G_G

Well its possible, requires coming up with your own algorithm. However, its not going to stop people from getting your graphics as they can still extract Scripts.rxdata and reverse the algorithm.

ForeverZer0

There is all types of ways to do such things. You can write a custom little script that simply scrambles the binary data, and then modify the RPG::Cache.load method to reverse the process. You still come back to the problem of a weak encryption by RMXP that will allow people to view your encryption/decryption methods.

If your using images, and are using a consistent file type, you can also think about removing the headers from the binary files. These will make it so that the pictures cannot be opened, and you would only need to have the load method add the header back on before using it. This will be a lot faster than decrypting an entire image. Look into this script and check out how some of the binary data is organized.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Apidcloud

May 08, 2011, 11:55:11 am #3 Last Edit: May 08, 2011, 12:01:33 pm by Apidcloud
Well, they I'd make a nice algorithm XD so they would need 10000000000000000000 years to reverse it oO

But how do I start?

@Edit ninja xD

Hm...that script basically 'makes' my pictures into pieces? XD
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

G_G

He's referring to the Zlib module, it contains header info for graphic files.

winkio

I think there's a general misconception about encryption.  There is no way to stop people from looking at your game's resources.  Even commercial games on the PS3 or PC have this same 'problem'.

Apidcloud

May 08, 2011, 12:08:41 pm #6 Last Edit: May 08, 2011, 12:12:27 pm by Apidcloud
what's an 'header info' first? xD

And...How would I reverse the method on load_bitmap method?
I mean, obviously i would have to reverse the algorithm...but firstly, how would i make it and make it into pictures?


And btw, can't i encrypt scripts.rxdata as well?
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

Valdred

No need dude. Just put a thing saying they aren't allowed to use it and you are safe. If they use it you can sue them and get rich ;)

Apidcloud

hm...well...<.< that would happen if i find someone using that graphics lool!
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

Apidcloud

Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

ForeverZer0

...still an utterly worthless task since the decryption method can be viewed by anyone...
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Apidcloud

Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

ForeverZer0

If they are capable of decrypting your archives to get to the encrypted picture files, it is a simple matter to find your decryption method and exploit it.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Apidcloud

I think a bit of more secure won't prejudice the game =/
And anyway, i'd like to learn how to do it as well xD

so it's a start i think... xD
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

ForeverZer0

Well, first you may want to learn more about scripting. You will need to get the basics down before you can learn some more advanced stuff.

You also will need to decide on what method you want to use. There are plenty of ways of screwing up the binary data so that it won't open as an image, which can be de-scrambled when you want to read it. I  created a method before that used a string password converted to a char array and uses that as salt to shift the bits on each byte in the file.  It used the remainder left over from the shift, and applied it to the next byte, which would make it so that each shift affected the one after it. You weren't cracking it without the same string passed to the reversal process. This method was very inefficient and is not a very good idea, since it is exceedingly slow to iterate every byte in file and convert it  every time you want to read it. DO NOT DO IT THIS WAY.

If you are only concerned with stopping novices, the easiest and least performance effecting way would be to remove the headers from all your files like I mentioned above. Modify RPG::Cache.load to add the headers back to the files before attempting to read them. If this is too complicated, then like I said, get some of the basics learned well first. Its a waste of both our times trying to learn something you won't understand. Its kinda like trying to learn long division before you know simple subtraction. You have to understand the first one to be able to know the second.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Apidcloud

well, i already know the basics XD

What i dont know, it's what you say about binary headers :P

As i never worked with this type of stuff before(encrypting), it's kinda normal that i don't know exactly what to do..
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

ForeverZer0

The headers are used in different image formats, nothing to do with encryption. You have to know how to use Array#pack to create the data correctly. I'll explain a bit more later, I'm at work right now.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Zeriab

1. File->Compress Game Data
2. Check 'Create Encrypted Archive'

You are done. RMXP handles the encryption and decryption transparently.

*hugs*

ForeverZer0

That's what I've been trying to explain.
If you can get past that, the pictures will be able to be decrypted very easily, so individual encryption for the files using Ruby is quite useless.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Apidcloud

May 11, 2011, 03:13:11 pm #19 Last Edit: May 11, 2011, 03:25:34 pm by Apidcloud
But I mean....nowadays there is a descriptor program =/ So, if I just rmxp encrypt, it'll be easily 'open' <.< xD

I know its quite useless since they can see the encryption methods, but to newbies, rmxp compress won't be a matter i think...since they can have the vgfgs program...


Yet, I found this link:
http://forum.chaos-project.com/index.php?topic=132.0

Its Bitmap2Code by blizzard... Guess it's something that will protect a bit more the pictures?
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

ForeverZer0

Not even close.
It simply creates the bitmaps by using the Bitmap class instead of loading from file. Its really only good for small images. The code is still written in standard RGSS syntax that even a beginner with very basic understanding of scripting could read.
I am done scripting for RMXP. I will likely not offer support for even my own scripts anymore, but feel free to ask on the forum, there are plenty of other talented scripters that can help you.

Apidcloud

hm.. =/ I don't have any ideas then XD

How should i remove the pictures headers ?
Instead of wanting to be somebody else, rather become somebody else



"I will treasure the knowledge like a squirrel treasures acorns."


Gibbo Glast 2D Engine - The sky is no longer a limit

Blizzard

Bitmap2Code was intended for small images. If you used it for all your big images, it would take way too long to load an image.
Check out our game brands:

Daygames
Game Night Games
Chugnar Games

Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.