I'm trying to encrypt files in my game.
The files are highscores, game save data, etc..
I'm using the XOR method.
Encryption and decryption works fine with one line of text.
But as soon as I try to encrypt\decrypt a complete file with text, some characters are missing.
The characters get thrown away when I decrypt the file again.
Example of encrypting a string:
s$="Try encrypting this"
encrypt_string$=""
key$="a"
For i = 1 to Len(s)
char$=Mid(s,i,1)
encrypt_string=encrypt_string+Chr(Asc(char) + Xor Acs (key))
Next
I open a file, and read one line of text.
Then I call the above encrypt function.
I do this line for line.
I save the encrypted file.
The problem starts when I open the encrypted file and read
it line for line.
I call the above encrypt function.
Now the file is smaller in size & some characters are missing.
Maybe i'm not using the correct encrypt method?
The files are highscores, game save data, etc..
I'm using the XOR method.
Encryption and decryption works fine with one line of text.
But as soon as I try to encrypt\decrypt a complete file with text, some characters are missing.
The characters get thrown away when I decrypt the file again.
Example of encrypting a string:
s$="Try encrypting this"
encrypt_string$=""
key$="a"
For i = 1 to Len(s)
char$=Mid(s,i,1)
encrypt_string=encrypt_string+Chr(Asc(char) + Xor Acs (key))
Next
I open a file, and read one line of text.
Then I call the above encrypt function.
I do this line for line.
I save the encrypted file.
The problem starts when I open the encrypted file and read
it line for line.
I call the above encrypt function.
Now the file is smaller in size & some characters are missing.
Maybe i'm not using the correct encrypt method?