Qbasicnews.com
April 12, 2021, 06:20:44 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: picture encryption  (Read 10629 times)
Dio
I hold this place together
*****
Posts: 874



« Reply #15 on: June 01, 2006, 04:43:48 AM »

i thought about this for awhile and the came to a simple answer:








i don't know how.
Logged

quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
marinedalek
Forum Regular
**
Posts: 123


WWW
« Reply #16 on: June 01, 2006, 06:39:45 AM »

Just to add more shortening to the much debated ( :winkwink: ) code...
Code:
pset (x,y), point(rx,ry)
pset (rx ,ry), point(x,y)
Logged

8% of the teenage population smokes or has smoked pot. If you're one of the 2% who hasn't, copy and paste this in your signature.
Neo
Na_th_an
*****
Posts: 2150



« Reply #17 on: June 01, 2006, 07:08:32 AM »

Quote from: "marinedalek"
Just to add more shortening to the much debated ( :winkwink: ) code...
Code:
pset (x,y), point(rx,ry)
pset (rx ,ry), point(x,y)

That won't work. You'll put the same color back, instead of swapping the colors.  :winkwink:
Logged
Anonymous
Guest
« Reply #18 on: June 01, 2006, 11:05:31 AM »

...and lose the color at x, y in the process >.>
Logged
Zack
*/-\*
*****
Posts: 3974



WWW
« Reply #19 on: June 01, 2006, 11:47:32 AM »

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.)
Logged

f only life let you press CTRL-Z.
--------------------------------------
Freebasic is like QB, except it doesn't suck.
Dio
I hold this place together
*****
Posts: 874



« Reply #20 on: June 03, 2006, 02:38:57 PM »

this was more of a "lets see if i could do this" project. and to my amazement (and a little horror) i did it. when i got this to work i was giddy like a little school girl. so proud of myself. but now i'm tired of this and i want to move on to other things. (which i'll need your help with also.)
Logged

quote="whitetiger0990"]whitetiger is.. WHITE POWER!!! [/quote]
Here
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!