LSB steganography on wav files
giannissam
Posts: 22
Hi all,
i've been trying to do LSB steg on wav files. (Hide information at the lsb of each sampleof the file).
I used
hardware:
the Demo board and an sd adapter from ucontroller.com.
software:
fsrw_shared
first of all thanx for the help i got from Radical eye software (for the fsrw code), Harisson (for the "file copy" code forums.parallax.com/forums/default.aspx?f=25&m=294194#m294254) and StefanL38 (for some help preparing the LSB)
The basic idea is in the following steps
1. EncData is the string we want to hide
2. EncBits are actually bytes containing the lsb from each character from Encdata.
For example if EncData is "Hi", "Hi" in binary is H=72d=01001000b and i=105d=01101001
Encbit0=00000000b Encbit8 =00000000b
Encbit1=00000001b Encbit9 =00000001b
Encbit2=00000000b Encbit10=00000001b
Encbit3=00000000b Encbit11=00000000b
Encbit4=00000001b Encbit12=00000001b
Encbit5=00000000b Encbit13=00000000b
Encbit6=00000000b Encbit14=00000000b
Encbit7=00000000b Encbit15=00000001b
3. Read and copy the header of the file from the source to the encoded
4. Read some bytes from the source and
4.1 if the following encbit is 01h mask the source byte with FEh (to make the lsb = 0) and add 1
4.2 else just mask it with FE
5. Write the modified bytes to the encoded file
the decoder reads the bytes modified and extracts the data. (at least it is supposed to do so)
Problems:
1. the encdata cant be more than 8 bytes. if i put more "0" at encbit it crashes??!!
2. the decoder is not working really well
i tried the code on a file with no data (silence) 44100Khz, 16 bit, mono (sil.wav) with EncData:="johnjohn". The encoded file is silc.wav
Any help or tips are appreciated
Post Edited (giannissam) : 4/7/2009 2:18:47 AM GMT
i've been trying to do LSB steg on wav files. (Hide information at the lsb of each sampleof the file).
I used
hardware:
the Demo board and an sd adapter from ucontroller.com.
software:
fsrw_shared
first of all thanx for the help i got from Radical eye software (for the fsrw code), Harisson (for the "file copy" code forums.parallax.com/forums/default.aspx?f=25&m=294194#m294254) and StefanL38 (for some help preparing the LSB)
The basic idea is in the following steps
1. EncData is the string we want to hide
2. EncBits are actually bytes containing the lsb from each character from Encdata.
For example if EncData is "Hi", "Hi" in binary is H=72d=01001000b and i=105d=01101001
Encbit0=00000000b Encbit8 =00000000b
Encbit1=00000001b Encbit9 =00000001b
Encbit2=00000000b Encbit10=00000001b
Encbit3=00000000b Encbit11=00000000b
Encbit4=00000001b Encbit12=00000001b
Encbit5=00000000b Encbit13=00000000b
Encbit6=00000000b Encbit14=00000000b
Encbit7=00000000b Encbit15=00000001b
3. Read and copy the header of the file from the source to the encoded
4. Read some bytes from the source and
4.1 if the following encbit is 01h mask the source byte with FEh (to make the lsb = 0) and add 1
4.2 else just mask it with FE
5. Write the modified bytes to the encoded file
the decoder reads the bytes modified and extracts the data. (at least it is supposed to do so)
Problems:
1. the encdata cant be more than 8 bytes. if i put more "0" at encbit it crashes??!!
2. the decoder is not working really well
i tried the code on a file with no data (silence) 44100Khz, 16 bit, mono (sil.wav) with EncData:="johnjohn". The encoded file is silc.wav
Any help or tips are appreciated
Post Edited (giannissam) : 4/7/2009 2:18:47 AM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Need to make your prop design easier or secure? Get a PropMod has crystal, eeprom, and programing header in a 40 pin dip 0.7" pitch module with uSD reader, and RTC options.
in the begining i had typed [noparse][[/noparse] 4 ] at the 1st post and the font size changed in the middle of it.
i was wondering how did that happened at the second post
i got a solution to that by mctrivia
i fixed the 1st post erased the second and made a new one saying that i fixed it
i realised that after erasing my second post you could be misleaded that i fixed my problem.
sorry for that
Had anyone read my code?
It's a little easier to read if rewritten like this:
In any case, each byte in your EncData needs eight bytes in EncBit. As things stand now, EncBit only has enough room for a four-character EncData. Anything larger and you start overwriting other data and eventually code.
Do you think that it would be better to do the convertion of the data (EncData=>Encbit) in the loop where i "copy" the bytes from source to target?
so the steps in the loop would be
1. Read bytes from source to Buf1
2. convert Encdata to a temp variable (8 encbits)
3. change the buf1 accordingly
4. Write the buf1 to target.
i guess in that way less memory in needed and encdata could be larger.
I'll try to do it this way and i'll post the code.
thanx again
This is my second version of encoder
it now supports up to 512 bytes at Encdata.
Any opinions are welcome
PS. You can quote or erase some unecessary text.str or text.dec lines in the basic loop (where the encoding is made).
I made it to version 4 of the encoder and version 3 for the decoder
The encoder is supposed to read the data to be encrypted from a file named "Data.txt" and the decoder writes the extracted data to a file named "extdata.txt".
My problem is that when i run the decoder i get 256 bytes from the original "Data.txt"
Can someone please help me to figure out why this is happening?
i believe that the problem is at my encoder but i cant find it.