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.
Encrypting file in image steganography
Page 1 of 12 Replies - 1506 Views - Last Post: 12 April 2012 - 11:38 PM
Replies To: Encrypting file in image steganography
#2
Re: Encrypting file in image steganography
Posted 12 April 2012 - 04:03 AM
#3
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[]:
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.
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.
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote



|