Code archives/File Utilities/Simple Encrypter/Decrypter
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
Okay, this isn't high security or anything like that, however, if you've got files that place objects, save high scores etc and you don't want people monkeying around with them this should be enough to put someone off. Simply set the input file and output file and it does the rest. have fun! | |||||
; =================================================================================================== ; Simple encrypter/decrypter ; 2003 Mental Illusion ; http://www.mentalillusion.co.uk ; rob@mentalillusion.co.uk ; =================================================================================================== ; I know this isn't high security or anything, but it's enough to make people not bother! ; Usage ; encrypt(Input file, output file, random seed) ; decrypt(Input file, output file) encrypt("test.txt","encrypted.txt",1) decrypt("encrypted.txt","decrypted.txt") End Function encrypt(input_file$,output_file$,seed) SeedRnd seed filein = ReadFile(input_file) fileout = WriteFile(output_file) WriteString (fileout,seed) While Not Eof(filein) temp$=ReadLine(filein) enc$="" For n=1 To Len(temp$) t=Asc(Mid(temp,n,1)) t=t+Rand(1,Rand(1,128)) If t>255 Then t=t-255 enc=enc+Chr$(t) Next WriteLine(fileout,enc$) Wend CloseFile (filein) CloseFile(fileout) End Function Function decrypt(input_file$,output_file$) filein = ReadFile(input_file) fileout = WriteFile(output_file) seed=ReadString(filein) SeedRnd seed While Not Eof(filein) temp$=ReadLine(filein) enc$="" For n=1 To Len(temp$) t=Asc(Mid(temp,n,1)) t=t-Rand(1,Rand(1,128)) If t<0 Then t=t+255 enc=enc+Chr$(t) Next WriteLine(fileout,enc$) Wend CloseFile (filein) CloseFile(fileout) End Function |
Comments
| ||
This could also be used for secret programing comunications..... |
Code Archives Forum