Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Saving String to a File

Author
Message
Cescano
9
Years of Service
User Offline
Joined: 4th Sep 2014
Location: Italy
Posted: 17th Jun 2015 17:40
While making a save data, if you save a string it could be readed and edited with a notecard opening the save file, is there a way to save a string so that it could not be readed using the notepad but crypted like all the other variables are (such long and floats)?
Lucka
19
Years of Service
User Offline
Joined: 1st Oct 2004
Location:
Posted: 17th Jun 2015 17:49
I can suggest you to "crypt" your strings before saving, the decrypt on loading (with the same alghoritm).

e.g. get avery single character in the the string and change it with the following letter in the alphabet, if is "z" just become a special character

Lucka - gawteam coder - www.gawgames.com
revenant chaos
Valued Member
17
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 19th Jun 2015 11:17 Edited at: 19th Jun 2015 11:49
Hi Cescano, I quickly threw an example together which demonstrates how to obfuscate strings within save files. There is plenty of room for improvement and is by no means "secure" but certainly does the job.

It works by retrieving the Ascii code for each character within the string, then uses bit shifting to modify the data before writing. The process is then reversed to read strings back from the file.

Sorry for the lack of comments, but it should be enough to get you going.

Login to post a reply

Server time is: 2024-04-26 16:21:50
Your offset time is: 2024-04-26 16:21:50