Hello . Am doing project on Audio Stegnography in java .I have coverted both msg and audio intobit stream .but while embedding the msg into audio LSB am not getting ,proper output.pl z do help sooon
here is ma code :
import java.io.*;
import java.awt.Component;
import java.awt.image.BufferedImage;
import java.io.FileWriter;
import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
class Conver1
{
public static void main(String[] args)
{
int offset = 0;
byte[] auBytes = new byte[100];
File file = new File("E://Audio Stegnography/Example/message.txt");
File audio = new File("E://Audio Stegnography/Example/audio.txt");
try
{
FileInputStream fin = new FileInputStream(file);
byte[] filecontent = new byte[(int)file.length()];
FileInputStream fin1 = new FileInputStream(audio);
byte[] filecontent1 = new byte[(int)file.length()];
fin.read(filecontent);
fin1.read(filecontent1);
for (int i = 0; i < filecontent.length; ++i)
{ // loop through stego
int byteVal = filecontent[i];
for(int j=7; j >= 0; --j ,++offset)
{ // loop through 8 bits of stego byte
int bitVal = (byteVal >>> j) & 1;
// change last bit of image byte to be the stego bit
auBytes[offset] = (byte)((auBytes[offset] & 0xFE) | bitVal);
System.out.println(auBytes[offset]);
File f =new File("me.txt");
try
{
FileWriter writer =new FileWriter(f,true);
writer.write( auBytes[offset] + System.getProperty("line.separator"));
writer.flush();
writer.close();
}
catch(IOException e)
{
e.printStackTrace();
}
//System.out.println(auBytes[offset]);
}
}
}
catch (Exception e)
{
System.out.println(" error");
}
}
}