Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Apidcloud on May 08, 2011, 11:45:09 am

Title: encrypting pictures..
Post by: Apidcloud on May 08, 2011, 11:45:09 am
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
Title: Re: encrypting pictures..
Post by: G_G on May 08, 2011, 11:48:23 am
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.
Title: Re: encrypting pictures..
Post by: ForeverZer0 on May 08, 2011, 11:54:28 am
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 (http://forum.chaos-project.com/index.php/topic,9426.0.html) script and check out how some of the binary data is organized.
Title: Re: encrypting pictures..
Post by: Apidcloud on May 08, 2011, 11:55:11 am
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
Title: Re: encrypting pictures..
Post by: G_G on May 08, 2011, 12:03:37 pm
He's referring to the Zlib module, it contains header info for graphic files.
Title: Re: encrypting pictures..
Post by: winkio on May 08, 2011, 12:06:41 pm
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'.
Title: Re: encrypting pictures..
Post by: Apidcloud on May 08, 2011, 12:08:41 pm
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?
Title: Re: encrypting pictures..
Post by: Valdred on May 08, 2011, 03:12:55 pm
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 ;)
Title: Re: encrypting pictures..
Post by: Apidcloud on May 08, 2011, 06:59:57 pm
hm...well...<.< that would happen if i find someone using that graphics lool!
Title: Re: encrypting pictures..
Post by: Apidcloud on May 10, 2011, 07:14:09 pm
still needing help >.<
Title: Re: encrypting pictures..
Post by: ForeverZer0 on May 10, 2011, 07:17:47 pm
...still an utterly worthless task since the decryption method can be viewed by anyone...
Title: Re: encrypting pictures..
Post by: Apidcloud on May 10, 2011, 07:24:13 pm
well nubs would'nt u.u
Title: Re: encrypting pictures..
Post by: ForeverZer0 on May 10, 2011, 07:29:08 pm
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.
Title: Re: encrypting pictures..
Post by: Apidcloud on May 10, 2011, 07:31:19 pm
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
Title: Re: encrypting pictures..
Post by: ForeverZer0 on May 10, 2011, 08:12:17 pm
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.
Title: Re: encrypting pictures..
Post by: Apidcloud on May 11, 2011, 08:07:57 am
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..
Title: Re: encrypting pictures..
Post by: ForeverZer0 on May 11, 2011, 11:40:11 am
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.
Title: Re: encrypting pictures..
Post by: Zeriab on May 11, 2011, 12:41:41 pm
1. File->Compress Game Data
2. Check 'Create Encrypted Archive'

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

*hugs*
Title: Re: encrypting pictures..
Post by: ForeverZer0 on May 11, 2011, 12:45:42 pm
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.
Title: Re: encrypting pictures..
Post by: Apidcloud on May 11, 2011, 03:13:11 pm
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?
Title: Re: encrypting pictures..
Post by: ForeverZer0 on May 11, 2011, 03:50:53 pm
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.
Title: Re: encrypting pictures..
Post by: Apidcloud on May 11, 2011, 04:01:11 pm
hm.. =/ I don't have any ideas then XD

How should i remove the pictures headers ?
Title: Re: encrypting pictures..
Post by: Blizzard on May 12, 2011, 06:28:11 am
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.