Is the One-time Pad truly unbreakable? Yes and no. You can brute force it and decrypt the message for every possible key of the same length as the message. But you are then left with every possible message that is of the same length. Which one is the real one? There is no way to tell. Even if you know a word that will be in the message and even if you know exactly where it is in the message then you are still left with every possible message that has that word in that place. You really haven't learned anything, because you already knew that word. So it is effectively unbreakable because of all the possible false decryptions.
"Wow", you say, "then why doesn't everybody use it?" There are many problems related to the One-time Pad. It suffers from problems of key generation, key distribution, and insuring keys are not reused. First you have to generate a key of random letters (or whatever is in the cipher alphabet) that is at least the length of the message to be decrypted. This is an expensive process and true random-ness is difficult to obtain. Next you have to get everybody that needs to decrypt your messages the keys and you have to make sure everybody is using the same key at the same time. Finally you have to make sure keys are never reused. Because if you reuse a key you've made the codebreakers job much easier.
Because of these problems One-time pads are very susceptable to social engineering and espionage to obtain the keys rather then breaking the cipher.
Most implementation of a One-Time Pad in computers use XOR on the bits instead of the Vigenère Square on the characters. The same principles still apply because I think the Vigenère Square works as a sort of alphabetical XOR. For another version, which was used during WWII, see One Time Pad.
Suppose you have a really important secret that you need to transmit. Say, you want to plan a surprise party for one of your friends, but you know she has a working quantum computer in her basement and routinely intercepts your mail. Are you going to entrust the security of your invitations to the simple factoring of large primes? No, of course not. In extreme cases like this, standard public key cryptography just doesn't cut it. You need the unbreakable (or at least as unbreakable as your random is random) reliability and utter inconvenience of the one time pad!
But this isn't like the old days I hear you complain, I have a lot of super-sensitive data to transmit. Far too much to sit there encrypting and decrypting it by hand! Don't worry, I've got you covered. As chkno points out in kid sister encryption, every lame-ass cipher-kiddie eventually writes what they think is a slick XOR encryption tool. Here's mine. I'll even give you:
But this isn't like the old days
I have a lot of super-sensitive data to transmit. Far too much to sit there encrypting and decrypting it by hand!
Super-duper-easy-to-follow instructions for preparing to reliably send exactly one secure message.
cat /dev/random > pad
Equally idiot-proof guide to sending your exactly one secure message.
Decryption of your exactly one secure message is left as an exercise for the reader's friend.
#!/usr/bin/perl # One-time pad cryptography. Yeah, whoo. Pseudomammal > NSA. # Little script, I hereby commit thee to the Public Domain. (June 24, 2003) $padfile = $ARGV[0] and $targetfile = $ARGV[1] or die(<<EOF One-time pad {en,de}cryption. (XOR swings both ways.) Usage: onetime.pl <pad file> <target file> I dump to stdout. Try: perl onetime.pl file.pad file.original > file.xor EOF ); open(PAD, $padfile) or die("Curses! I couldn't open $padfile.\n"); open(TARGET, $targetfile) or die("Drat! I failed to open $targetfile.\n"); (stat($padfile))[7] >= (stat($targetfile))[7] or die("Well that's a hell of" . " a thing! Pad $padfile is smaller than target $targetfile.\n"); # The juicy bit. while(read(TARGET, $targetbits, 1024)) { read(PAD, $padbits, length($targetbits)); print $padbits ^ $targetbits; # I love you, Perl. } close(PAD); close(TARGET); # Thanks for playing!
printable version chaos
Everything2 Help