Hide a Text File Inside an Audio File 🎵

Learn how to embed a text file into an audio file with updated methods for better concealment and security.

Hide a Text File Inside an Audio File 🎵
Omustardo
27.5K views • Jan 11, 2013
Hide a Text File Inside an Audio File 🎵

About this video

2014 Update: I've learned a lot more about programming since I made this video and it makes me cringe a bit looking back on it. I redid the program so it's not quite so poorly done.. http://pastebin.com/NVvzvZfQ

This video explains the process that I used to hide a .txt file in a .wav file. I tried to make it as straightforward as possible, but it still might be a bit difficult to understand if you haven't had any experience with programming. If this video gets a positive response I may make more videos like it, and I'll also adjust the level of detail/difficulty based on responses.
I did this program in java and using Eclipse (http://www.eclipse.org/downloads/). If you're interested in programming but don't know where to start, I recommend downloading Eclipse and reading through some tutorials and basic info here: http://docs.oracle.com/javase/tutorial/getStarted/index.html
If you have any questions about programming just google it and you can almost always find answers for people who have asked the same things.

This method of encoding is known as steganography. It is a form of "security through obscurity" since there is almost no noticeable difference to message on which the data is encoded on. Historically, steganography would involve techniques like writing a second message in invisible ink on another message. http://en.wikipedia.org/wiki/Steganography

You can take a look at the code in two separate java files here:
AudioSecrets.java - http://pastebin.com/w8LpGqmB
StdAudio.java - http://pastebin.com/Dr4JZWi0
I wrote AudioSecrets.java but StdAudio.java was written for "Introduction to Programming in Java: An Interdisciplinary Approach" by Robert Sedgewick and Kevin Wayne.

The most straightforward way to run the program for people without experience programming is probably to download and run Eclipse. Create a new java project and then save the two files from the pastebin link as "AudioSecrets.java" and "StdAudio.java" in C:\workspace\projectName\src
Then drag the two java files from the folder into the project in Eclipse.
In C:\workspace\projectName you need to put the .txt file that you want to encode, and the .wav audio file(must be 44.1kHz, 16 bit monoaural) or leave it out if you want the program to automatically generate the audio clip.
Once that's done, go to Eclipse, select AudioSecrets.java and then click the "Run" button(green circle with a white arrowhead in it)
The program should run and you'll see the instructions in the bottom part of the screen.

An alternative is http://mozaiq.org/encrypt/
which allows you to put text into an image. It's definitely a much more polished program than what I wrote, and you don't have to bother with downloading anything.

-----What you need to know-----
An array is something called a Data Structure. It can be thought of as a grid where each square in the grid can contain data. This data can be accessed much more easily than if you set a separate variable for each element.
The .wav audio files used in this program are just arrays of numbers between -1.0 and 1.0
Text can be converted into an array of characters, and each character is equivalent to an integer. Integers are numbers like -2,0,3,4,5. Some of the conversions between characters and integers can be seen here: http://i.imgur.com/UroJR.png

-----Encoding the Message-----
In Short: To encode a text into an audio file I took each individual character and divided it by an arbitrary large number(10000) and then added it to one of the numbers in the array of numbers that made up the audio file. This division allowed the character to become a very small value which allowed it to be put into the audio file without noticeably changing the sound.
Detailed: For example, if my message were "Hello", when converted into an array of characters it would be {H,e,l,l,o} and since each character is equivalent to a specific integer it would be equivalent to {72,101,108,108,111} if converted to integers.
This table from wikipedia shows the equivalent integers for characters: http://i.imgur.com/UroJR.png
I divided each of those numbers by a large number and then added it to the sound file. The actual process is slightly more complex as there has to be error checking. For example, since the audio file can only have numbers between -1.0 and 1.0, I had to make sure that adding the numbers wouldn't equal or go above 1.0

-------
The description ran out of space. The rest can be found here: http://pastebin.com/n27ebdGZ
^I mentioned a bug in there which was explained by pur3stownage and philipwhiuk
Doubles and their smaller relative, floats are 'floating point' numbers retained in memory as a number to a power. Most numbers aren't stored exactly correct.
- Thanks for the explanation, that is very good to know
-------

Disclaimer: I am not an expert programmer, so my code may not be the most efficient or most clear.

Tags and Topics

Browse our collection to discover more content in these categories.

Video Information

Views

27.5K

Likes

460

Duration

8:31

Published

Jan 11, 2013

User Reviews

4.6
(5)
Rate:

Related Trending Topics

LIVE TRENDS

Related trending topics. Click any trend to explore more videos.

Trending Now