Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.
It would be rather trivial to write one with code something like this:

#define possibleNumCharsToSub someNumber
#define sizofPad anInteger

Code:
while(numInts < anInteger){
    srand(clock());
    int randomNumber = rand();
    randomNumber /= someNumber;
    saveNumberToPad(randomNumber);
}

One time pads are unbreakable but very inconvenient for a number of reasons like the fact that you have to be sure to get the pad to the recipient without it being read.

Be sure to seed the random number generator with something like clock() or it will produce the same series of numbers every time.

Public / private key encription schemes like RSA are very secure if you use a big key and convenient as well. There have been reports that mathematicians have developed much better methods to crack the keys in recent years. Do you want to protect your data from your little sister or the NSA? This could influence your choices. Tripple DES is good as well.

I recommend: Applied Cryptography - http://www.amazon.com/Applied-Cryptography-Protocols-Algorithms-Source/dp/0471117099
 
Last edited:
As an Amazon Associate, MacRumors earns a commission from qualifying purchases made through links in this post.
Because even for the government one-time pad encryption is painfully slow, and the average citizen of any country doesn't need that level of encryption. I'm curious, why do you want it?
 
Because even for the government one-time pad encryption is painfully slow, and the average citizen of any country doesn't need that level of encryption. I'm curious, why do you want it?

I don't think that they would be slow because you would proceed directly to substitution. I think that they're not used much because of the possibility of someone accessing the pad and because of the convenience of public-private key algorithms, for example they allow you to authenticate the sender.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.