Skip to content

Commit d4673d9

Browse files
authored
Update README.md
1 parent 0175e9d commit d4673d9

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed

README.md

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
# Bit Flip Cipher
22

3-
Bit Flip Cipher is a simple encryption tool that encrypts text using a key-derived SHA-256 hash with XOR bit flipping. Since this is a symmetric cipher, decryption is performed using the same key that was used for encryption.
3+
Bit Flip Cipher is a simple encryption 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.
44
This tool was created as a fun project for me to learn more about C and Linux.
55

6-
**Version**: 1.0.0
6+
**Latest Version**: 1.1.0
77

8-
## How the Cipher Works
8+
## How the Cipher Works
99

10-
1. The user provides a key (password) for encryption/decryption.
10+
### Encryption
11+
1. The user provides a key (password) and the text to be encrypted.
1112
2. A SHA-256 hash of the key is generated.
1213
3. Each byte of the input text is XOR-ed with the corresponding byte from the hash (looping through the hash as needed).
13-
4. The resulting text is the output.
14-
5. Applying the process again with the same key will decrypt the text.
14+
4. The resultant is encoded to Base64 to ensure that it is printable.
15+
5. The Base64 ciphertext is the output.
16+
17+
### Decryption
18+
1. The user provides a key (password) and the Base64 encoded text obtained from encryption.
19+
2. The Base64 text is decoded back to the original XOR-ed encrypted form.
20+
3. A SHA-256 hash of the key is generated.
21+
4. 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.
22+
5. The resultant plaintext is the output
1523

1624
## Installation
1725

@@ -21,26 +29,22 @@ As of now, a package file is available only for Debian-based distros (Debian, Ub
2129

2230
- Download the latest `.deb` package by running this command:
2331
```sh
24-
wget https://github.com/noinoiexists/Bit-Flip-Cipher/releases/download/bflip-v1.0.0/bflip_1.0.0_amd64.deb
32+
wget https://github.com/noinoiexists/Bit-Flip-Cipher/releases/download/bflip-v1.1.0/bflip_1.1.0_amd64.deb
2533
```
2634
- Install it using your package manager (`apt`):
2735
```sh
28-
sudo apt install ./bflip_1.0.0_amd64.deb
36+
sudo apt install ./bflip_1.1.0_amd64.deb && rm ./bflip_1.1.0_amd64.deb
2937
```
3038
The tool is now installed and can be run as `bflip`.
3139

3240
### Method 2: Compile from Source
3341

34-
**Requirements**: `gcc`, `make`, `libssl-dev`
42+
**Requirements**: `gcc`, `make`, `git`, `libssl-dev`
3543
- Install the required tools and libraries using your package manager.
36-
- Download the latest source code archive by running this command:
37-
```sh
38-
wget https://github.com/noinoiexists/Bit-Flip-Cipher/archive/refs/tags/bflip-v1.0.0.tar.gz
39-
```
40-
- Extract, compile and install the code:
44+
- Clone this repository, compile and install the code:
4145
```sh
42-
tar -xvzf ./bflip-v1.0.0.tar.gz
43-
cd Bit-Flip-Cipher-bflip-v1.0.0/
46+
git clone https://github.com/noinoiexists/Bit-Flip-Cipher.git
47+
cd Bit-Flip-Cipher/
4448
make
4549
sudo make install
4650
```
@@ -52,17 +56,19 @@ This will compile the binary and install it in `/usr/local/bin/`. It can be run
5256

5357
## Usage
5458

55-
56-
`bflip -k <key> [text]`
59+
Encrypt: `bflip -k <key> [text]`
60+
Decrypt: `bflip -d -k <key> [base64_text]`
5761

5862
Examples:
59-
`bflip -k secretkey 'hello world'`
60-
`bflip -k 'multi-word secretkey' 'hello world'`
61-
`printf 'hello world' | bflip -k secretkey`
63+
`bflip -k secretkey 'hello world'`
64+
`bflip -k 'multi-word secretkey' 'hello world'`
65+
`echo -n 'hello world' | bflip -k secretkey`
66+
`bflip -d -k secretkey 'BASE64_ENCODED_TEXT'`
6267

68+
Options:
6369
```
64-
Options:
6570
-k <key> Specify the encryption/decryption key (string).
71+
-d Decrypt bflip encrypted text (Base64 string).
6672
-h, --help Display the help menu.
6773
-v, --version Display the version information.
6874
```

0 commit comments

Comments
 (0)