A C implementation of the simple XOR cipher for encrypting and decrypting arbitrary files.
git clone https://github.com/koppi/xor && sudo make -C xor release install
(Note: using simply make
instead of make release
will produce debug versions of the tools with the address sanitizer and undefined behavior sanitizer enabled.)
or
curl -L 'https://github.com/koppi/xor/raw/master/xor.c' | gcc -O2 -x c -o /usr/local/bin/xor -
xor -e abc.key -i abc.txt -o abc.enc # to encrypt
xor -d abc.key -i abc.enc -o abc.txt # to decrypt
where:
abc.txt
is the plaintext file,abc.key
is the single-use pre-shared key,abc.enc
is the encrypted file.
- to speed up the key stream generation of the Linux pseudo-random number generator, install
haveged
:
sudo apt -y install haveged
With a key that is truly random, the result is a one-time pad, which is unbreakable in theory.
- Jakob Flierl - koppi