main(i,c)int*c;{for(c=fopen(c[1],"r");i=~getchar();putchar(getc(c)^~i));}
OTPs are provably unconditionally secure, this means that you can not break them with any amount of compute time. It is mathematically impossible to break a OTP.
Okay, so a OTP is a marvelously secure crypto system, so why isn't it more widely used? This is due to convenience, in order to use a OTP you have to trade pads with each person you wish to communicate with. The pad should be a truly random number, so you would ideally want a radioactive decay card or something to generate the pad. The system will critically depend on the true randomness of the pad, and of course on keeping the pad known only to you and the recipient.
This is where the inconvenience comes in, you must somehow trade pads with your intendend recipient securely, this means meeting in person or using a trusted courier.
C = M xor OTP
You send the ciphertext to your recipient, the recipient knowing the OTP also can recover the message by computing the reverse, XORing the ciphertext C with the OTP:
M = C xor OTP
You must never re-use the OTP, other wise it wouldn't be a "One-Time" pad anymore, and it would loose it's unbreakable properties as information would start to be leaked.
#!/usr/local/bin/perl open(P,$ARGV[0]);print pack(C,unpack(C,$_)^unpack(C,getc(P)))while$_=getc;
% chmod 700 otp
main(i,c)int*c;{for(c=fopen(c[1],"r");~(i=getchar());putchar(getc(c)^i));}
% cc -o otp otp.c
To encrypt, do (same usage for C or perl versions):
% otp pad < msg > cipherNow you can send "cipher" to your recipient in the clear, just email will do fine as you will be the only two people who will ever be able to decipher the message.
To decrypt your recipient does:
% otp pad < cipher > msgto recover the message.
Basically if you use pseudo-random number generators they are going to be the weak point in the system, unless you have external input like a radio-active decay card, or timings of the milliseconds between keystrokes with proper entropy estimation as used by PGP.