Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
picture encryption
#20
Code:
#define infile "infile.bmp"
#define passfile "passfile.bmp"
#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
There's a simple encryption app. Infile is the file you want to encrypt, passfile is the password file, and outfile holds the name of the encrypted file you want to create. Infile has to be EXACTLY the same size as passfile, otherwise it won't work (using a password the same length as the data to encrypt makes the code theoretically unbreakable). To decipher, put whatever outfile you used in the infile field, use the original passfile, and make up a name for the new, unciphered file.
If you are encrypting a bitmap file, make a password file by just opening up mspaint and drawing a picture that has the exact same dimensions of the picture you want to encrypt. (Note: that won't work for some compressed image formats like png, because even two pictures of the same dimensions will have different compressed sizes.)
f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Reply


Messages In This Thread
picture encryption - by Dio - 05-27-2006, 02:32 AM
picture encryption - by Neo - 05-27-2006, 02:40 AM
picture encryption - by Dio - 05-27-2006, 02:47 AM
picture encryption - by Neo - 05-27-2006, 02:49 AM
picture encryption - by Dio - 05-27-2006, 03:25 AM
picture encryption - by Neo - 05-27-2006, 03:36 AM
picture encryption - by Dio - 05-29-2006, 01:56 AM
picture encryption - by Zack - 05-29-2006, 10:10 PM
picture encryption - by Dio - 05-30-2006, 01:12 AM
picture encryption - by Anonymous - 05-30-2006, 04:57 AM
picture encryption - by Dio - 05-30-2006, 12:38 PM
picture encryption - by Dio - 05-30-2006, 12:41 PM
picture encryption - by Anonymous - 05-30-2006, 12:44 PM
picture encryption - by Dio - 05-31-2006, 12:40 AM
picture encryption - by Kylemc - 06-01-2006, 01:07 AM
picture encryption - by Dio - 06-01-2006, 12:43 PM
picture encryption - by marinedalek - 06-01-2006, 02:39 PM
picture encryption - by Neo - 06-01-2006, 03:08 PM
picture encryption - by Anonymous - 06-01-2006, 07:05 PM
picture encryption - by Zack - 06-01-2006, 07:47 PM
picture encryption - by Dio - 06-03-2006, 10:38 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)