Search code examples
c#mp3steganography

how to hide data in mp3 data frame using C#


after reading the header fame, the data frame starts, i want to know what is the data frame size, that a mp3 player reads, so that if i change single bit of each frame without causing much to the sound of the file, and how can i change a single bit (last bit) so effect is minimum in C#. please help me


Solution

  • I was able to figure it out and came up with my own algorithm, Rzr what ever you said was right.

    The mp3 file is highly compressed file any bit change in any of the frame would introduce tremendous noise.

    there is way to work around for this,

    Soln_1: Hide the text data and in any of the bit of each byte and reconstruct the frame using humming code 
    
    Soln_2: which i was able to do it, using Layer III, BitRate=128000, SampleRate=441000, Padding=0
    

    drawbacks : file size would be increased abit which the un-intended user cant predict, unless he has the exact copy of the original mp3 file.

    Able to achieve : without noise i was able to hide text data upto 5kb in a 3mb mp3 file

    Work Around:

    step1: scan every 8 bytes in each frame
    step2: take a 8 bits from the text data
    

    Pre-definee location of where to put each bit of text data in each frame e.g: 4th location.

    step3:  check every 4th bit location of each byte of the frame is same as the each bit of the text data are same
    

    E.g.: text data one byte is 01110001

    1st 8 byte from the mp3 data frames

    byte_1: 01101111 -->4th location bit is 0
    byte_2: 01111111 -->4th location bit is 1
    byte_3: 01111001 -->4th location bit is 1
    byte_4: 01111011 -->4th location bit is 1
    byte_5: 01100011 -->4th location bit is 0
    byte_6: 01101100 -->4th location bit is 0
    byte_7: 01101011 -->4th location bit is 0
    byte_8: 01110011 -->4th location bit is 1
    

    so this byte from the frame, every 4th bit location is having the bits which are same as the text data bits.

    Step4: note down the location of the byte in the mp3 data frame, in this case its "1" that is 1st location
    

    if the byte from the mp3 data frame doesn't matches the data bits then skip the byte and go on to the next byte, keep on doing the same till entire text data is hidden.

    Step5:now take all the locations where the text data is present and add these as a byte to the data frame of mp3.
    

    this is one solution i was able to successfully implemented.