Best way to save settings etc.

Find quick help here to get you started with Hollywood
Post Reply
User avatar
Clyde
Posts: 348
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Best way to save settings etc.

Post 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!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Best way to save settings etc.

Post by SamuraiCrow »

The Zip plugin supports encryption. Look for it on the download tab.
I'm on registered MorphOS using FlowStudio.
User avatar
Allanon
Posts: 732
Joined: Sun Feb 14, 2010 7:53 pm
Location: Italy
Contact:

Re: Best way to save settings etc.

Post 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 ;)
User avatar
Clyde
Posts: 348
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Best way to save settings etc.

Post by Clyde »

Nice suggestions, thanks to both of you!

Is it really that easy to "read" the executable?
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Best way to save settings etc.

Post 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.
I'm on registered MorphOS using FlowStudio.
User avatar
Clyde
Posts: 348
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Best way to save settings etc.

Post by Clyde »

I see, thanks!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: Best way to save settings etc.

Post 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...
User avatar
Clyde
Posts: 348
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Best way to save settings etc.

Post by Clyde »

Thanks for your considerations, jpv. That is interesting!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: Best way to save settings etc.

Post 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.
I'm on registered MorphOS using FlowStudio.
User avatar
Clyde
Posts: 348
Joined: Sun Feb 14, 2010 12:38 pm
Location: Dresden / Germany

Re: Best way to save settings etc.

Post 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!
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
Post Reply