Page 1 of 1

Is there a way to encrypt contents of a save file?

Posted: Fri Jul 25, 2014 9:37 pm
by boogerflicker
I am working on a text adventure but I can't find a way to encrypt the save game. The way I am doing it now is with an XOR Encrypt/Decrypt function(not written by me) that encrypts each string before I write it to file. Then it loads the file and decrypts string by string. The only problem I am running in to is that this functioin only encrpyts strings. I have many integers like for health and gold that it won't encrypt. To get around this I turned each integer into a string before encrypting and writing to file. Then on Decrpyt I decrypt then convert back to integer with VAL. This gives me a problem that I can't find a way around. If the value was let's say 1000 I turn it into a string then encrypt. When I decrypt do VAL then print the result I end up with a 1 or a 0. Am I losing something somewhere in the STR$/VAL? Is there an easier way to do this? If there is let me know. If you think you can help me figure out why I'm losing the integer value and help me fix it then let me know and I'll put the code up.

Re: Is there a way to encrypt contents of a save file?

Posted: Sun Jul 27, 2014 12:18 pm
by burger2227
Post the code.

You can encrypt text by converting each text character into an ASCII code value and adding about 1 to 33 to it so that it becomes a different character. Don't exceed 255 for normal ASCII typing codes up to 122. Your encryption code must be loosing characters during the conversion or during decryption.