BrainFuckEncryption (BFE) is a C-based encryption system that converts text into a sequence of '>' (forward movement), '<' (backward movement), and '+' (character selection) using a customizable key vector. It includes a compression tool to reduce the size of the encrypted output and Python clients for encryption, decryption, compression, and decompression.
bfe.c: Encrypts text using a key vector (default:a-z,0-9,A-Z, space) and a starting position (sPos).
Supports spaces and uses the shortest path (forward with'>'or backward with'<') to each character.bfe_compress.c: Compresses encrypted output (e.g.,>>>+<<+to[4]>+[2]<+) and decompresses back to the original format.bfe_client.py: A Python script for encryption and decryption using thebfebinary.bfecli.py: A Python script that combines encryption/compression and decompression/decryption using bothbfeandbfe_compressbinaries.- Command-line interface with flags:
--message,--spos,--kvecfor encryption--input,--compress,--decompressfor compression--encrypt,--decryptforbfecli
- Random generation of
sPosandkey vectorif not provided. - Supports large messages (up to 1MB).
C Compiler: GCC (e.g., via MinGW or MSYS2 on Windows)Python 3: For running Python scriptsGit: For version control
Clone the Repository:
git clone https://github.com/your-username/BrainFuckEncryption.git
cd BrainFuckEncryption
Compile the C Programs:
Ensure GCC is installed.
gcc src/bfe.c -o bfe
gcc src/bfe_compress.c -o bfe_compress
Verify Python Installation:
python --version
Encrypt a message with optional starting position and key vector:
./bfe --message "hello world"
With specific sPos and custom key vector:
./bfe --message "hello" --spos 0 --kvec "abc123 "
Compress an encrypted string:
./bfe_compress --input ">>>>+<<+" --compress
Decompress back:
./bfe_compress --input "[4]>+[2]<+" --decompress
Encrypt a message:
python bfe_client.py --message "hello world"
Decrypt an encrypted string:
python bfe_client.py --decrypt --message ">>>>+<<+" --spos 0 --kvec "abc123 "
Encrypt and compress:
python bfecli.py --encrypt --message "hello world" --compress
Decompress and decrypt:
python bfecli.py --decrypt --message "[4]>+[2]<+" --spos 0 --kvec "abc123 "
-
Encryption:
Maps each character in the message to a position in the key vector, moves the pointer using'>'or'<'to minimize steps, and uses'+'to select. -
Compression:
Converts runs of'>'or'<'into compact forms like[4]>, preserving'+'. -
Decryption:
Reverses encryption by tracking pointer movements and character selections. -
Decompression:
Expands[count]>or[count]>back into sequences of characters.
- Default key vector includes: lowercase letters, digits, uppercase letters, and a space.
- Encryption is deterministic given the same
sPosandkey vector. - Ensure
bfeandbfe_compressbinaries are in the same directory asbfecli.pyor available in yourPATH. - Dynamic allocation allows handling of very large messages efficiently.
Feel free to open issues or submit pull requests to improve or extend the project.