Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Audio Stegnography

  1. #1
    Junior Member
    Join Date
    Feb 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Audio Stegnography

    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");
    }

    }
    }


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Audio Stegnography

    Welcome to the Forum! Please read this topic to learn how to post code correctly and other useful tips for newcomers.

Similar Threads

  1. AUDIO problem
    By green001 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: January 14th, 2014, 04:41 PM
  2. Threads, Audio Application, Audio loading twice error
    By dpjmie in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 19th, 2013, 01:18 PM
  3. audio
    By lanya in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 14th, 2013, 05:41 PM
  4. audio not working HELP
    By silverpen10 in forum The Cafe
    Replies: 0
    Last Post: December 19th, 2012, 02:29 PM
  5. Audio In My Program
    By Fordy252 in forum What's Wrong With My Code?
    Replies: 7
    Last Post: February 7th, 2011, 08:46 AM