Basic codeing system for DBpro by Anonymous Coder2nd Aug 2004 10:48
|
---|
Summary You can code a file then (if you remember your codeing-key!) decode it. Description There is a file 'file.cod'. You can code this file, and only that Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com rem This program (codeing system 0.2) is created by Attila Ihász rem Sory, my english is not perfect. I am hungaryan. hide mouse 0: dim ASCII(size) for reset=1 to size ASCII(reset)=0 next reset undim ASCII(0) coded$="" decoded$="" cls print "(C)odeing or (D)ecodeing?" 1: if inkey$()="c" then goto code if inkey$()="d" then goto decode goto 1 rem !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! C O D E !!!!!!!!!!!!!!!!!!!!!! code: isanyfile=FILE EXIST("file.cod") size=FILE SIZE("file.cod") if isanyfile=0 print "No file,please rename the file to 'file.cod'" goto 0 endif open to read 1,"file.cod" read string 1,file$ close file 1 fileis$="This is the file: "+file$ print print print "The file is opend,ready to code." print fileis$ print "Please enter the codeing key." input key print print "codeing..." dim ASCII(size) for reading=1 to (size) ASCII(reading)=ASC(mid$(file$,(reading))) next reading rem codeing step 1 for code=1 to (size) ASCII(code)=ASCII(code)+key 4: if ASCII(code)>255 ASCII(code)=ASCII(code)-255 goto 4 endif next code rem codeing step 2 for code=1 to (size) ASCII(code)=ASCII(code)+code 5: if ASCII(code)>255 ASCII(code)=ASCII(code)-255 goto 5 endif next code rem codeing step 3 rem codeing step 4 rem codeing step 5 rem codeing step 6 rem restringing dim car$(size) for writing=1 to (size) car$(writing)=chr$(ASCII(writing)) next writing for write=1 to (size) coded$=coded$+car$(write) next write if file exist("coded.cod") then delete file "coded.cod" rem make file "coded.cod" open to write 2,"coded.cod" write string 2,coded$ close file 2 print print "The codeing is complite." print "The file:" print file$ print print "The coded file:" print coded$ wait key goto 0 rem !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! D E C O D E !!!!!!!!!!!!!!!!!! decode: isanyfile=FILE EXIST("coded.cod") size=(FILE SIZE("coded.cod")-2) if isanyfile=0 print "No file,please rename the file to 'coded.cod'" goto 0 endif open to read 3,"coded.cod" read string 3,file$ close file 3 fileis$="This is the file: "+file$ print print print "The file is opend,ready to decode." print fileis$ print "Please enter the decoding key." input key print print "Decodeing..." dim ASCII(size) for reading=1 to (size) ASCII(reading)=ASC(mid$(file$,(reading))) next reading rem decodeing step 1 for code=1 to (size) ASCII(code)=ASCII(code)-key 3: if ASCII(code)<1 ASCII(code)=ASCII(code)+255 goto 3 endif next code rem decodeing step 2 for code=1 to (size) ASCII(code)=ASCII(code)-code 2: if ASCII(code)<1 ASCII(code)=ASCII(code)+255 goto 2 endif next code rem decodeing step 3 rem decodeing step 4 rem decodeing step 5 rem decodeing step 6 rem restringing dim car$(size) for writing=1 to (size) car$(writing)=chr$(ASCII(writing)) next writing for write=1 to (size) decoded$=decoded$+car$(write) next write if file exist("decoded.cod") then delete file "decoded.cod" rem make file "decoded.cod" open to write 4,"decoded.cod" write string 4,decoded$ close file 4 print print "The decode is compite." print "The coded text:" print file$ print print "The decoded text:" print decoded$ wait key goto 0 |