Don't forget the ASCII codes only range 0 to 127, if the Xor'ed number is outside this range, you probably will lose some of the characters in the string.
A better method might be to convert each character into an integer value something like this:
Then save each integer instead of lines of strings. When you decrypt it just reverse the process, something like decrypted$=decrypted$+Chr$(encrypted_integer) Xor Asc(key$). The downside to this is an integer will take up four bytes whereas one ASCII character only takes up one byte, so the resulting file will be four times larger using integers.
Note, you will also have to either save an integer describing the final size of each string, or use a sequence of characters to show the end of each string, if each of the strings are to remain seperate.
A better method might be to convert each character into an integer value something like this:
For i = 1 to Len(s$) encrypt_integer=Asc(Mid$(s$,i,1)) Xor Asc(key$) ; Save integer to file here Next
Then save each integer instead of lines of strings. When you decrypt it just reverse the process, something like decrypted$=decrypted$+Chr$(encrypted_integer) Xor Asc(key$). The downside to this is an integer will take up four bytes whereas one ASCII character only takes up one byte, so the resulting file will be four times larger using integers.
Note, you will also have to either save an integer describing the final size of each string, or use a sequence of characters to show the end of each string, if each of the strings are to remain seperate.