Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with Outputting to file
#15
Yetifoot is right - I didn't read the code properly and so I didn't notice that you were modifying each character with a different value. That is more secure than plain XOR - the cracker can't simply look for patterns as I described above. Still, don't trust your banking numbers to it. :wink:
Here's an encryption method that is, in principle, unbreakable, because there is no pattern or uniform algorithm whatsoever to work with. It's simple: there are two files, infile and passfile. They must be EXACTLY the same size. Character 0 in infile is XORed with character 0 in passfile. Character 1 in infile is XORed with character 1 in passfile, character 2 in infile is XORed with character 2 in passfile, and so on. The results are stored in outfile.
Code:
#define infile "infile.txt"
#define passfile "passfile.txt"
#define outfile "outfile.enc"
dim as integer ifHandle,pfHandle,ofHandle,fpos
dim as ubyte ifTemp,passTemp
ifHandle=freefile
pfHandle=ifHandle+1
ofHandle=pfHandle+1
open infile for binary as #ifHandle
open passfile for binary as #pfHandle
open outfile for binary as #ofHandle
if lof(ifHandle)<>lof(pfHandle) then
    print "Error: different file lengths."
    sleep
    end
end if
do
    get #ifHandle,,ifTemp
    get #pfHandle,,passTemp
    put #ofHandle,,chr$(ifTemp xor passTemp)
    fpos+=1
    if fpos>=lof(ifHandle) then exit do
loop
print "Done."
sleep
close
red_marvin originally suggested this method to me.
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply


Messages In This Thread
Problem with Outputting to file - by Torahteen - 06-18-2006, 09:31 PM
Problem with Outputting to file - by WaffleMan - 06-19-2006, 03:26 AM
Problem with Outputting to file - by Torahteen - 06-20-2006, 06:04 AM
Problem with Outputting to file - by axipher - 06-20-2006, 06:46 AM
Problem with Outputting to file - by yetifoot - 06-20-2006, 09:56 AM
Problem with Outputting to file - by Torahteen - 06-20-2006, 08:11 PM
Problem with Outputting to file - by Anonymous - 06-20-2006, 11:55 PM
Problem with Outputting to file - by yetifoot - 06-21-2006, 01:54 AM
Problem with Outputting to file - by DrV - 06-21-2006, 06:04 PM
Problem with Outputting to file - by Torahteen - 06-21-2006, 07:46 PM
Problem with Outputting to file - by Zack - 06-21-2006, 10:55 PM
Problem with Outputting to file - by Anonymous - 06-22-2006, 01:43 AM
Problem with Outputting to file - by yetifoot - 06-22-2006, 03:01 AM
Problem with Outputting to file - by Torahteen - 06-22-2006, 08:31 PM
Problem with Outputting to file - by Zack - 06-22-2006, 08:55 PM
Problem with Outputting to file - by Anonymous - 06-23-2006, 05:14 AM
Problem with Outputting to file - by yetifoot - 06-23-2006, 06:53 AM
Problem with Outputting to file - by Anonymous - 06-23-2006, 08:24 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)