The Sound of Encryption
The purpose of the project is to use the Java programming language to encrypt messages into MIDI files. To do this, first we had to understand the MIDI file. Through use of the JMusic java package, a MIDI files is manipulable by its components. The MIDI file is a score, which is comprised of parts. Each part contains one or more phrases, and each phrase contains notes. We were able to manipulate the notes to hold the ASCII values of characters. These characters came from an encrypted string of text. We used password-based encryption and implemented the Twofish encryption algorithm. We then added the muted phrase, comprised of the encrypted characters, to an existing part, and saved the new score as a MIDI file. We were then able to successfully extract and hide encrypted messages within MIDI files. We were able to make the program dynamic enough to support any MIDI file and allow the user to select whichever part and phrase to place the message in.
In this project a Java program was created to hide and encrypt messages in a MIDI file using steganography. Steganography is the process of hiding one thing inside of another. Steganography has been used since the beginning of writing. It is used with invisible ink or with code words inside of a sentence, but in this project, stegonography is used with a MIDI file. Encryption is the converting of a message into a form that cannot be read. In the Java program the message is encrypted using the Twofish algorithm and a password. The encrypted message is placed into notes that make up the score of the MIDI file. After the message is encrypted into notes, it was then muted to further the steganography and make it theoretically unnoticeable when listening to the music.
A MIDI file, or the Musical Instrument Digital Interface, was chosen as the medium in which to hide the message. A MIDI file is made up of a score. The score is made up of parts, the parts are made up of phrases and the phrases are made up of notes. MIDI files contain only musical instruments. By using MIDI files, we were able to easily customize notes from the encrypted message. For the message to be hidden within the MIDI file, we had to convert it to numeric values. To produce these numeric values, we used the standard ASCII values.
ASCII is the American Standard Code for Information Interchange. It is basically a table, which stores a standard numeric value for each character. These standard ASCII values were used to set the pitch of new notes in the new phrase we created within an existing part of a MIDI file. The phrase that contained the message was then muted out and started at the same time as another phrase, so that it was not noticeable.
This project was programmed using the Java programming language. Java is an object oriented programming language that was created around 1995 by Sun Microsystems. The original version of Java was called Oak, and was designed in the 1990s. It was designed to be able to control different consumer electronic devices using the same software. The Java programming language is platform independent, or can run from any type of personal computer, mainframe, or workstation.
To hide the message:
1. First, we parse the MIDI file by calling on the MidiParser of the JMusic package.
2. Then the user selects the part of the MIDI in which to hide the message.
3. The user then selects which phrase of the MIDI file to replace with the hidden message.
4. The selected phrase is then moved.
5. The message is encrypted using password-based encryption with either MD5 and DES algorithm, or SHAA and Twofish algorithm.
6. New notes are created, one for every character of the encrypted message.
7. These notes are then made into a phrase.
8. The phrase is placed where the selected phrase was and the rest of the phrases are moved one over.
9. The part is rewritten, this time containing the new phrase.
10. The part is replaced in the score.
11. The score is written as a MIDI file.
To retrieve the message:
1. The midi is parsed using the MidiParser of the JMusic package.
2. The user then selects which part of the MIDI to decode.
3. Then the user selects which phrase of the part to decode.
4. The user enters the password.
5. The pitches of the notes are extracted from the chosen phrase.
6. The pitches are converted into characters.
7. The message is then decrypted using the Twofish algorithm and the given password.
8. The message is displayed.
The result of the program was a newly created MIDI file, which contained the encrypted message. There was a significant change in the music. The file size was also noticeably larger. We tried the program with many different MIDI files, but always ended up with a larger MIDI file, on account of the additional data, and some distortion to the music.
Although there was a significant change in the MIDI file, we believe that the program was still a success because it was able to successfully hide and retrieve a text message, which had been encrypted. We found that the size difference, although noticeable, is not significant because any song in MIDI format is available in numerous sizes. The sound difference is only a concern if the MIDI file is suspected as being abnormal.
We believe that if we used the straight JSound API supplied with the Java SDK, it is possible that we could have avoided the distortion to the music. We cannot find a reason why this distortion happens unless it has something to do with the open source JMusic Java library.
The most significant achievement of the project is that a message is encrypted and hid inside of a MIDI file using a Java program. By doing this, we have made use of a new medium in which steganography can be applied.
We would like to thank Sergei Piletsky of MIIK Ltd. of the Ukraine for providing an educational license of the JNI Wrapper program.
Christopher Hoppe of the US Patent and Trademark Office for being our mentor and helping with research.
Kristian Sandburg of Colorado University for explaining the discrete Fourier transform.
Churchhouse, Robert. Codes and ciphers : Julius Caesar, the Enigma, and the internet.
Cambridge: Cambridge University Press, 2002.
Garms, Jess, et. al. Professional Java Security. Birmingham: Wrox, 2001.
Glatt, Jeff. The Beginnings of MIDI. 25 Oct. 2004
John, Corinna. Steganography-Hiding Messages in MIDI Songs. The Code Project. 25 Oct. 2004 <http://www.thecodeproject.com/csharp/steganodotnet5.asp>.
Sierra, Kathy. Head First Java. Sebastopol: O'Reilly, 2003.
Singh, Simon. The Code Book. New York: Doubleday, 1999.