2 Replies - 4697 Views - Last Post: 12 April 2012 - 11:38 PM Rate Topic: -----

#1 mirror  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 07-April 12

Encrypting file in image steganography

Posted 11 April 2012 - 10:48 PM

Actually this is more a conceptual question than the practical one.
I m doing image steganography and needed to hide any file in an image.
I m converting the file and image into byte[].
Now i need to add the detail(file name,size) of the file to be hidden in the image.
Else while decryption extracting the hidden file without the file information is impossible.
My question is how can i hide the file information in byte[] and then extract it.

Is This A Good Question/Topic? 0
  • +

Replies To: Encrypting file in image steganography

#2 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8324
  • View blog
  • Posts: 31,857
  • Joined: 06-March 08

Re: Encrypting file in image steganography

Posted 12 April 2012 - 04:03 AM

You can start here:

http://www.dreaminco...__steganography
Was This Post Helpful? 1
  • +
  • -

#3 mirror  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 21
  • Joined: 07-April 12

Re: Encrypting file in image steganography

Posted 12 April 2012 - 11:38 PM

thanks.
But the code suggests to embed any text in an image.
I am successful in doing that.
But i suppose embedding files into image is slightly difficult.

Here is the code i tried to convert the file and its name into byte[]:


public static byte[] getBytesFromFile(String file) throws IOException {
    File file1 = new File(file);
    InputStream is = new FileInputStream(file1);
    long length = file.length();
    byte[] bytes = new byte[(int)length];
 
    int offset = 0;
    int numRead = 0;
    while (offset < bytes.length
           && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
        offset += numRead;
    }
    is.read(bytes);//converting files into byte[]
    byte msg[] = text.getBytes();//converting file name into byte[]
    byte[] combined = new byte[bytes.length + msg.length];//creating new array that will contain                                                                                            both file byte[] and name byte[].

    System.arraycopy(bytes,0,combined,0,bytes.length);//copying file byte[] into combined byte[]
    System.arraycopy(msg,0,combined,bytes.length,msg.length);//adding file name into combined byte[]
     
  
    is.close();
    return combined;
}


Now i embed this byte[] into image using LSB algo.
While extracting the file i need the name of the file to be retrieve.
Now my problem is how can i insert file name in this byte[] and extract it back,because the above code isn't working.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1