Simple image Steganography
in
Share your Work
•
3 years ago
http://en.wikipedia.org/wiki/Steganography
this type of steganography masks the last 3 bits so it supports (i think) 512 colors
I have created a simple steganography creator and interpreter
to use copy the programs, and run the first one stegcreator
pick the image you want to hide first, the cover one second, and the image steg.png will be created in your sketch folder.
To unhide your image copy steg.png into the other sketch folder, and run the other sketch click the screen and there is your image
ps. not for use by terrorists
hiding sketch
- PImage steg,hide;
- int hidr =0;
- int hidg =0;
- int hidb =0;
- String hidePath,maskPath;
- //created by adam schmidt
- void setup(){
- frame.setTitle("Athaddiustego");
- hidePath = selectInput();
- maskPath = selectInput();
- hide = loadImage(hidePath);
- steg = loadImage(maskPath);
- // image(steg,0,0);
- steg.loadPixels();
- hide.loadPixels();
- for(int x =0;x<1000;x++){
- for(int y =0;y<1000;y++){
- if(x<hide.width&&y<hide.height){
- int hidcol =hide.pixels[x+y*hide.width];
- hidr = (hidcol >> 16) & 0xFF; // Faster way of getting red(argb)
- hidg = (hidcol >> 8) & 0xFF; // Faster way of getting green(argb)
- hidb = hidcol & 0xFF; //0xff==0000000000011111111
- //
- hidr= hidr>>5;//only 3 bitsout of 8
- //
- //
- hidg=hidg>>5;
- //
- //
- hidb=hidb>>5;
- }else{
- hidr =0;
- hidb =0;
- hidg =0;
- }
- int col =steg.pixels[x+y*steg.width];
- int r = (col >> 16) & 0xFF; // Faster way of getting red(argb)
- int g = (col >> 8) & 0xFF; // Faster way of getting green(argb)
- int b = col & 0xFF; // Faster way of getting blue(argb)
- b= b&248;//11111000= 254 0&0 =0; 1&0 =0 1&1=0;// clears only last one//down 2^bit-1 from 255 per bit
- b = b|hidb;//1||0 = hidb; b= 0; | so 0&0 =0; 1&0 =1 1&1=0;
- r= r&248;//11111000= 254 0&0 =0; 1&0 =0 1&1=0;// clears only last one
- r = r|hidr;//1||0 = hidb; b= 0; | so 0&0 =0; 1&0 =1 1&1=0;
- g= g&248;//11111000= 254 0&0 =0; 1&0 =0 1&1=0;// clears only last one
- g = g|hidg;//1||0 = hidb; b= 0; | so 0&0 =0; 1&0 =1 1&1=0;
- steg.pixels[x+y*steg.width]=color(r,g,b);
- }
- }
- steg.updatePixels();
- steg.save("steg.png");
- }
- void draw(){
- }
uncovering sketch
- PImage steg;
- int c =1;
- int t =0;
- //created by adam schmidt
- void setup(){
- steg = loadImage("steg.png");
- size(steg.width,steg.height);
- image(steg,0,0);
- }
- void draw(){
- t=0;
- image(steg,0,0);
- }
- void mouseClicked(){
- steg.loadPixels();
- for(int x =0;x<width;x++){
- for(int y =0;y<width;y++){
- int col =steg.pixels[x+y*width];
- int r = (col >> 16) & 0xFF; // Faster way of getting red(argb)
- int g = (col >> 8) & 0xFF; // Faster way of getting green(argb)//n from 0-7
- int b = col & 0xFF;
- //if((b&0x1)==0){//just like normal color mask this one is only las bit tho
- steg.pixels[x+y*width]=color((r&0x7)<<5,(g&0x7)<<5,(b&0x7)<<5);
- // }2^bit-1//0x7=111
- // if((b&0x1)==1){
- // steg.pixels[x+y*width]=color(255);
- // }
- }
- }
- steg.updatePixels();
- }