Xors Binary File Encyption/Decryption [Solved]
Blitz3D Forums/Blitz3D Programming/Xors Binary File Encyption/Decryption [Solved]| 
 | ||
| I was wondering where I can find a snippet where you can encrypt/decrypt a binary file using XOR? I found only the example and do you think this is good enough? http://www.blitzbasic.com/b3ddocs/command.php?name=Xor | 
| 
 | ||
| 
;Simple xor encryption with crappy key
;swap the input and output files to see it in action...(decryption is encrpytion in reverse)
seedrnd 1 ;this is your key...(actually the key is the same length as the file and is determined as a random sequence by this seed)
infile = readfile("yourinputfile.txt")
outfile = writefile("youroutputfile.txt")
while(not(eof(infile)))
    writebyte outfile,readbyte(infile) xor rand(0,255)
wend 
closefile outfile
closefile infile
end
 | 
| 
 | ||
| Thanks Matty, works great. solved :) | 
| 
 | ||
| @Matty Thanks You. :) | 
| 
 | ||
| ** Sorry Wrong Thread ** |