Skip to content

hmZa-Sfyn/BrainFuckEncryption

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 BrainFuckEncryption (BFE)

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.


✨ Features

  • 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 the bfe binary.
  • bfecli.py: A Python script that combines encryption/compression and decompression/decryption using both bfe and bfe_compress binaries.
  • Command-line interface with flags:
    • --message, --spos, --kvec for encryption
    • --input, --compress, --decompress for compression
    • --encrypt, --decrypt for bfecli
  • Random generation of sPos and key vector if not provided.
  • Supports large messages (up to 1MB).

🛠 Installation

Requirements

  • C Compiler: GCC (e.g., via MinGW or MSYS2 on Windows)
  • Python 3: For running Python scripts
  • Git: For version control

Setup

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

🚀 Usage

🔐 Encryption (bfe)

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 "

📦 Compression/Decompression (bfe_compress)

Compress an encrypted string:

./bfe_compress --input ">>>>+<<+" --compress

Decompress back:

./bfe_compress --input "[4]>+[2]<+" --decompress

🐍 Python Client (bfe_client.py)

Encrypt a message:

python bfe_client.py --message "hello world"

Decrypt an encrypted string:

python bfe_client.py --decrypt --message ">>>>+<<+" --spos 0 --kvec "abc123 "

🧪 Integrated CLI (bfecli.py)

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 "

⚙️ How It Works

  • 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.


📝 Notes

  • Default key vector includes: lowercase letters, digits, uppercase letters, and a space.
  • Encryption is deterministic given the same sPos and key vector.
  • Ensure bfe and bfe_compress binaries are in the same directory as bfecli.py or available in your PATH.
  • Dynamic allocation allows handling of very large messages efficiently.

🤝 Contributing

Feel free to open issues or submit pull requests to improve or extend the project.


About

BrainFuckEncryption (bfe) is a C-based encryption system that converts text into a sequence of '>' and '+' characters using a customizable key vector.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors