Yes, .jar files.
What are You trying to do? Image atlas ? Or something else ?
I mainly don't want my resources 'bluntly' out in the open
Now I know I can't fully stop people from grabbing/editing the resources but I'd like to remove the 'bluntly' part and possibly store everything in "Cache files" ^_^ (.dat etc)
You can use the built-in zip file api in the standard java api and rename the .zip file to .dat
Never thought of that
Wouldn't they just need to rename the .dat
I'll fiddle around with some ideas tonight in my IDE ^_^EDIT
How would I 'casually' go about storing a .png
in a .dat
file (Encoded, see below)
Beautiful charset output: 3cÿrBR·ÒçÓW~ò$ãÔ€ä5Al½ô
Feedback's still welcome guys =D
I really advice against doing this because it is much more trouble than it is worth, but you can do something _really_ simple, like this:
1. Compress your resources (loosely) into a ZIP archive
2. Apply a simple encryption algorithm (really simple, since the purpose here isn't to 'keep them out' so much as it is to making it not so blunt to acquire access to the resources. Also, the encryption algorithm is entirely local so there isn't much in the way of someone tearing apart your usage of the Java encryption API and grabbing the key if they really wanted it anyway...) So (in this example) XOR encryption.
3. Decorate a FileInputStream (to the Zip Archive containing your resources) with an XorDecryptionInputStream (basically just applies an XOR to every byte you read from the stream to decrypt it. A simple one byte key is entirely sufficient for these purposes) and pass that to the ZipInputStream
5. Use the ZipInputStream as you would.
XOR encryption isn't that great, and there are flaws (you have to avoid NULL bytes etc) but assuming you just want to make the archive unreadable\unrepairable, it should work fine for your purposes.
Also, with XOR Encryption
Original XOR Key = Encrypted
Original XOR Encrypted = Key.
So if they know what the data is supposed to be, your key is exposed. And they can figure out some signature in a Zip Archives Filesystem.
But all that is besides the fact, since security isn't an issue here.