我的工作我的最後一年的項目在JAVA音頻stegnography
1)圖像中隱藏文本圖像中
2)圖像
3)文字的音頻文件(WAVE)
我已經成功完成了1)和2),並附上了源代碼,如果有人可能需要它。 我在第三個軟件中遇到了麻煩,即將數據隱藏在音頻文件中。 我創建一個音頻輸入流出一個波形文件,並將它的數據讀入一個字節數組 但許多事情都不清楚,而在閱讀我猜測第44個字節是頭字節?(因爲該文件是WAVE格式)或者根本不復制標題。 問題是...... 在再次解碼時,我必須從字節數組中新創建的音頻文件中讀取數據。而且我無法找到隱藏數據的字節。
任何人都可以告訴我,當我們從音頻輸入流中讀取數據到字節數組時,究竟發生了什麼,我的意思是什麼實際上讀入字節數組?
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 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 does not get displayed
如果我解碼字節數組只是編輯之後,然後正常工作,並顯示隱藏的消息,但之後再次建立一個字節數組,讀入它audioinputsream數據,然後解碼該字節數組..它不起作用。我想知道爲什麼?請幫幫我。
這個詞是'隱寫術。 – EJP 2013-04-06 09:53:55