Page 1 of 1

Best way to save settings etc.

Posted: Fri Dec 14, 2018 3:17 pm
by Clyde
Hey there,

what would be a proper way to save some specific settings/data like highscores or unlocked content to a file, which cannot be manipulated by the user? I know how to read and write text files, but I would like to encrypt them somehow, so no one can manipulate it.
What is the best approach in Hollywood? Is there an inbuilt way?

Thanks!

Re: Best way to save settings etc.

Posted: Fri Dec 14, 2018 3:27 pm
by SamuraiCrow
The Zip plugin supports encryption. Look for it on the download tab.

Re: Best way to save settings etc.

Posted: Fri Dec 14, 2018 8:58 pm
by Allanon
If you encrypt zipped files I suggest to do not store the password in clear in your code, use a function to decode the stored pwd and then use it to decrypt your data, also do not store the password in variable names like "pwd" or "pass" or "password" so that it can be harder to find the pwd assignment looking into the executable.
Hope this help ;)

Re: Best way to save settings etc.

Posted: Fri Dec 14, 2018 9:17 pm
by Clyde
Nice suggestions, thanks to both of you!

Is it really that easy to "read" the executable?

Re: Best way to save settings etc.

Posted: Sat Dec 15, 2018 5:05 am
by SamuraiCrow
Unix and clones have a utility called "strings" that identifies any ASCII strings in an executable. It has been ported to the Amiga also.

Re: Best way to save settings etc.

Posted: Sat Dec 15, 2018 10:19 am
by Clyde
I see, thanks!

Re: Best way to save settings etc.

Posted: Sat Dec 15, 2018 11:30 am
by jPV
Allanon wrote:
Fri Dec 14, 2018 8:58 pm
If you encrypt zipped files I suggest to do not store the password in clear in your code, use a function to decode the stored pwd and then use it to decrypt your data, also do not store the password in variable names like "pwd" or "pass" or "password" so that it can be harder to find the pwd assignment looking into the executable.
Although if you compile your Hollywood executable with the -compress option, then those variable names and passwords in your code won't be in readable form by just looking the executable. Might be enough if the project doesn't need that serious protection.

Edit: uhmm... or maybe it's not that safe way, because Hollywood stores an uncompressed applet to a temporary directory in this case, so if user knows to look that...

Re: Best way to save settings etc.

Posted: Mon Dec 17, 2018 11:14 am
by Clyde
Thanks for your considerations, jpv. That is interesting!

Re: Best way to save settings etc.

Posted: Mon Dec 17, 2018 8:24 pm
by SamuraiCrow
Actually, jPV was probably on the right track. Just doing the same thing using CompressFile and DecompressFile commands on a text file containing the pass key and using the @FILE preprocessor directive on the compressed version would work without unpacking the application to a temporary file as far as I'm aware. Using a DefineVirtualFile to contain the pass key might be wise as well.

Re: Best way to save settings etc.

Posted: Mon Dec 17, 2018 10:33 pm
by Clyde
Nice! I like how this progresses.

I also looked a bit into VirtualFiles but you can't save to them. But storing the password in there is a great idea!