Bit Flip Cipher is a simple cryptography tool that encrypts text using a key-derived SHA-256 hash with XOR bit flipping and gives a Base64 output. Since this is a symmetric cipher, decryption is performed using the same key that was used for encryption.
Note: This project was made by me prior to any study of cryptography, hence the naive and unspecific name. While it may seem similar to Vigenere cipher, it is coincidental as I had no knowledge of it then.
Latest Version: 1.1.0
This cipher was created for educational purposes and is definitely not secure.
- The user provides a key (password) and the text to be encrypted.
- A SHA-256 hash of the key is generated.
- Each byte of the input text is XOR-ed with the corresponding byte from the hash (looping through the hash as needed).
- The resultant is encoded to Base64 to ensure that it is printable.
- The Base64 ciphertext is the output.
- The user provides a key (password) and the Base64 encoded text obtained from encryption.
- The Base64 text is decoded back to the original XOR-ed encrypted form.
- A SHA-256 hash of the key is generated.
- Each byte of the encrypted text is XOR-ed with the corresponding byte from the hash (looping through the hash as needed). This produces the original text, as this process is symmetric.
- The resultant plaintext is the output
As of now, a package file is available only for Debian-based distros (Debian, Ubuntu, Mint, Kali, etc) and can be installed using Method 1. For others, you can follow Method 2.
- Download the latest
.debpackage by running this command:wget https://github.com/noinoiexists/Bit-Flip-Cipher/releases/download/bflip-v1.1.0/bflip_1.1.0_amd64.deb
- Install it using your package manager (
apt):sudo apt install ./bflip_1.1.0_amd64.deb && rm ./bflip_1.1.0_amd64.deb
The tool is now installed and can be run as bflip.
Note: For ARM devices (Mac, Raspberry Pi, Mobile, etc), use the arm64 package instead.
Requirements: gcc, make, git, libssl-dev
- Install the required tools and libraries using your package manager.
- Clone this repository, compile and install the code:
git clone https://github.com/noinoiexists/Bit-Flip-Cipher.git cd Bit-Flip-Cipher/ make sudo make install
This will compile the binary and install it in /usr/local/bin/. It can be run as bflip.
Note: If you wish to install a different version instead, replace the version numbers (vX.Y.Z) in the above steps with the one you want or you can find the respective files in the Releases page.
Encrypt: bflip -k <key> [text]
Decrypt: bflip -d -k <key> [base64_text]
Examples:
bflip -k secretkey 'hello world'
bflip -k 'multi-word secretkey' 'hello world'
echo -n 'hello world' | bflip -k secretkey
bflip -d -k secretkey 'BASE64_ENCODED_TEXT'
Options:
-k <key> Specify the encryption/decryption key (string).
-d Decrypt bflip encrypted text (Base64 string).
-h, --help Display the help menu.
-v, --version Display the version information.
This implementation was created by me, Nithik R and is protected under the MIT Licence. You can learn more about it in the LICENCE file.