Saturday, March 27, 2010

Numlock Morse Code

In Neal Stephenson's novel Cryptonomicon, Randy Waterhouse finds himself in a prison in the Philippines.  Randy has a laptop with some very valuable information on it that some bad guys want, but since the information is encrypted, they can't get to it.  So they allow Randy to keep his laptop in his jail cell but the only place he can put it is on top of a short, locked, file cabinet that has been chained to the floor.  The battery has been removed so the only way to get power is to leave it plugged in on top of the filing cabinet.  The thing is, Randy doesn't even know what the information is yet, because it's encrypted too. He needs to decrypt the information, but not let the bad guys know he is decrypting it, or rather, he wants them to think he's doing it but give them the wrong information.

He can't show the real decrypted info on the laptop display because he is afraid that the bad guys are trying to use a Van Eck Phreaking antenna that is inside the filing cabinet so they can eavesdrop on his laptop screen (he's already made sure there are no hidden cameras).   So he comes up with some fake decryption that he shows on the screen, but the real info has to be displayed another way.  He writes a program that takes text and translates it into Morse Code.  The program turns the the scroll lock light on and off to simulate dots and dashes.  Now he knows the real info from the blinking light, and the bad guys get the fake info he showed on the screen.

I thought that was kind of cool so I wrote a program that does just that.  The only difference is my program blinks the num lock key instead of the scroll lock key (my keyboard doesn't have a scroll lock key).

If you were to load this application on your windows PC and run the following from the command line:

c:\waterhouse\waterhouse.exe /T:"sos"

You would get this:




Notice the /T:"sos" that comes after the name of the application.  The /T: switch says, "turn this text into Morse code."

You could also type this:

c:\waterhouse\waterhouse.exe /F:c:\morse.txt

/F: says to load a file and turn that into Morse code.  It can be a file on your computer, a UNC path or a file on the web (just prepend it with http://).  The contents of the file c:\morse.txt on my computer happens to be my name.  So when you hit enter, you see this:




Help is available by typing the /? or /help switches.

You can download the compiled application here. (Windows only)

You can download the source code here.

You can download Microsoft's free Visual Basic 2008 Express development environment here.

Wikipedia: Morse code