java - Audio stegnography -


i working on final year project in java

1)hiding text in image

2)image in image

3)text in audio file (wave)

i have completed 1) , 2) , have attached source code if may need it. having trouble in 3rd 1 i.e hiding data in audio file . create audioinputstream out of wave file , read it's data byte array many things not clear,while reading i'm guessing 1st 44 bytes header bytes?(since file of wave format) or header not copied @ all. problem .... @ time of decoding again have read data newly created audio file in byte array. , i'm not able locate bytes have hidden data.

can tell me happens when read data byte array audioinputstream , mean gets read byte array?

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 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 displayed here      try {     //              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 not displayed  

if decode byte array after editing , works fine , displays hidden message, after again creating byte array , reading audioinputsream data , decoding byte array .. not work. wonder why? please me.

the first 44 bytes indeed header of wav (see https://ccrma.stanford.edu/courses/422/projects/waveformat/)

if open file in hex editor, you'll see looks (http://imgur.com/ilia40r)

if compare data in file , data read inputstream, matches.

you should close , re-open stream if need read file again. if can mark file, mark before reading, , call reset() after first read done.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -