This is an ANSI C implementation of both binary XOR and classic A-Z one time pad encryption. It does not generate keys. For best results, use truly random numbers, such as from a hardware random number generator, or by picking Scrabble tiles at random.

One-time pad encryption is the only known theoretically unbreakable encryption available. However, it requires perfectly random numbers, completely secure key distribution, and each key can only be used once. This makes it highly impractical compared to most modern cryptography.

The Crypto Museum has more information about how one-time pads were used historically by spies during the Cold War.

## Download

## Usage

------------------------------------------------------------------------------ xor 1.0.0 Usage: xor [-edx] keyfile [sourcefile] > outfile ------------------------------------------------------------------------------ xor implements both symmetrical binary XOR encryption/decryption, and the classic One Time Pad encryption using only the capital letters A-Z. You must specify a keyfile to use on the command line, and the source data to be encrypted/decrypted can come from either a file specified as the second argument, or from standard input. The default mode of operation is XOR, which allows completely symmetrical binary encryption/decryption both ways. The classic One Time Pad using only capital letters is also implemented, and requires the -e or -d flags for encrypt or decrypt mode. The keyfile must contain either a series of truly random bits (such as from a hardware random number generator, /dev/random isn't good enough), or a series of random capital letters in the case of classic A-Z encryption. The security of either method is only as good as the random numbers used. Keys should be used only once, and then destroyed by both the sender and recipient. Some examples: XOR (binary) encryption: xor keyfile [sourcefile] > encrypted_file XOR (binary) decryption: xor keyfile [sourcefile] > original_file OTP classic A-Z encryption (key and source data must be all capital letters): xor -e keyfile [sourcefile] > encrypted_file OTP classic A-Z encryption (key and source data must be all capital letters): xor -d keyfile [sourcefile] > original_file