Audio stegnography

highdefinition

New Member
i am working on my final year project in JAVA 1)hiding text in a image2)image in a image3)text in a audio file (WAVE)i have successfully completed 1) and 2) and have attached the source code if anybody may need it.i am having trouble in the 3rd one i.e hiding data in a audio file .I create a audioinputstream out of a wave file and read it's data into a byte arraybut many things are not clear,while reading i'm guessing the 1st 44 bytes are the header bytes?(since the file is of WAVE format) or the header is not copied at all. The Problem is ....at the time of decoding again i have to read the data from the newly created audio file in a byte array. And i'm not able to locate the bytes where i have hidden data. Can anybody tell me what exactly happens when we read data into a byte array from a audioinputstream , i mean what actually gets read into the byte array?\[code\]File fileIn = new File("C:\\Users\\Rahul\\Desktop\\pro\\Don't Stay.wav");AudioInputStream audioInputStream =AudioSystem.getAudioInputStream(fileIn);int avail= audioInputStream.available();System.out.println("bytes available " +avail);System.out.println(audioInputStream.markSupported());int bytesPerFrame = audioInputStream.getFormat().getFrameSize(); // Set an arbitrary buffer size of 1024 frames.int numBytes = 1024 * bytesPerFrame;byte[] audioBytes = new byte[numBytes];audioInputStream.read(audioBytes);byte btext[]=Stego_text("good morning!");byte bcoded[]=steg.encoding(audioBytes,btext,0); byte[] stg= a.decode_text(audioBytes); String obtain= new String(stg); System.out.println(">>>"+ obtain); //the hidden message gets successfully displayed heretry { // AudioSystem.write(audioInputStream, Type.WAVE, new File("C:\\Users\\Rahul\\Desktop\\pro\\Don't Stay_restored.wav")); } catch (Exception e) { e.printStackTrace(); } byte[] audioBytesNew = new byte[numBytes]; audioInputStream.read(audioBytesNew); byte[] stg1= a.decode_text(audioBytesNew); String obtain1= new String(stg1); System.out.println(">>>"+ obtain1); //the hidden message does not get displayed \[/code\]if i decode the byte array just after editing , then it works fine and displays the hidden message, but after again creating a byte array and reading into it audioinputsream data and then decoding that byte array .. it does not work. i wonder WHY? please help me.
 
Back
Top