fxor: xor based file encryption

emailXOR is an extremely commonplace operation in cyphers. The reason is the output of encryption can be decrypted using the same XOR function. In other words:

A ⊕ B = C
implies
C ⊕ B = A
OR
C ⊕ A = B

fxor is a simple tool that uses the same logic to encrypt and decrypt files using a key file from the user. Te tool does a byte by byte XOR and can take care of situations where the key is larger than input and vice versa. fxor can even handle binary files or size 50GB.

Installation

To install fxor on Ubuntu, run:

$ git clone https://github.com/abderraouf-adjal/fxor.git
$ cd fxor
$ make
$ sudo make install

Usage

Syntax:
$ fxor IN_FILE KEY_FILE
$ fxor IN_FILE KEY_FILE OUT_FILE [OPTION]

Options:
-r: Overwrite (destroy contents) OUT_FILE if it exists
-s: Start output from OUT_FILE beginning and replace bytes, Perfect to encrypt/decrypt IN_FILE and output to IN_FILE!

To generate a key file, use any of the following methods:

$ openssl rand -out <FILE NAME> <FILE SIZE IN BYTES>
OR
$ openssl rand -engine rdrand -out <FILE NAME> <FILE SIZE IN BYTES>
OR
$ dd if=/dev/random of=<FILE NAME> bs=1M count=50
OR
$ dd if=/dev/urandom of=<FILE NAME> bs=1M count=50

You can also use scripts/opssl_rand in the project tree to generate a key file same in size as <IN FILE>:

$ opssl_rand <IN FILE> <RANDOM KEY FILE>

On GitHub: fxor

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s