winzip icon

Wave steganography

Submitted on: 12/22/2019 5:57:34 PM
By: The trick  
Level: Beginner
User Rating: By 1 Users
Compatibility: VB 6.0
Views: 1775
     Hi everyone!
Today i want to talk about the cryptography. I've made the example of using the special cryptography - the steganography. This method hides the fact of encryption of the data. There are lot of kinds of the steganography. Today i'll talk about LSB-method when data is hided into the least significant bits of the audio file. It looks as though you are exchanged a audio files, but really you send a secret data. People who don't know about this method they will not even suspect about secret data. In some cases it can be very useful.

How does it work?

A WAVE-PCM file (without a compressions) contains sound data. Really the sound is an analog event, i.e. continuous. In order to convert it to digital form you should quantize it with lossy. This process is characterized by two parameters: bitness and sample per second. "Bitness" affects to how many levels can it contains in each sample. "Sample per second" affects to how many frequencies do you can hear:

In this case we are interested only the bitness of an audio. It can be 32, 24, 16, .... bits per each sample. Main idea of steganography (in this case) is rewrite the least significant bits to our data. The more you overwrite bits the greater the distortion.
This picture explains it graphically:

As you can see, it stores all hidden data to certain bits in the audio data (in this picture 4 bits to each sample). Also note that for storing the data you need to use the bigger file size than the source file. For instance, if you use 3 bit for the encoding the result file will have the size that is 16/3 times greater than source. I've said 16 because i use the 16 bps wave file in my example.
In the attached example i also save the original file name. In general, format of the data is described in the picture:

When the packing occurs it gets each byte from the source file. Then the subroutine extracts the necessary bits from the source file and clears corresponding bits in the audio data. Further the subroutine sets bits using bitwise-OR operator. For extracting the necessary bits it uses the masks and the shifts. The mask leaves necessary bits and the shift places them to the beginning of the byte.
Unpacking works vice versa. It extracts bits from audio data and builds file using corresponding bits.
Hope the review will be useful.

Thanks for attention!
Best Regards, The trick.
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net

Other 6 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

12/23/2019 9:17:24 PMEddie Bole

Hi The Trick. Thanks for your good explanation of the LSB type of encryption. It sounds really interesting. Just letting you know that the three graphics in your comments are not showing up. I also wanted to ask if you knew how to add sound at a particular frame in an AVI file (as you seem really knowledgeable about sound)? I can add a wav file to the START of an AVI file, but could not work out how to add it at a particular frame. I can send to you what I have done so far. Regards Eddie.
(If this comment was disrespectful, please report it.)

12/24/2019 5:09:24 PMThe trick

Eddie Bole, thank you for the reply!
I reported to administrator about the problem with the images. Regarding your question i answered to your e-mail.
(If this comment was disrespectful, please report it.)

12/30/2019 2:45:37 AMJohn Korejwa

The menu checked properties don't work as intended, and the default "bitness" values for "packing" and "unpacking" are different. Otherwise, this works as advertised.
(If this comment was disrespectful, please report it.)


Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)

To post feedback, first please login.