Skip to main content

balue

Balue is a Python package that implements a multi-layered encryption algorithm for educational purposes. It combines substitution, permutation, and XOR encryption techniques to provide a basic encryption and decryption functionality.

Features

  • Substitution Cipher: Shifts each byte of the plaintext based on a key.
  • Permutation Cipher: Shuffles the bytes of the text.
  • XOR Cipher: XORs the shuffled bytes with the key.

Installation

Using Poetry

  1. Install Poetry if not already installed:

    curl -sSL https://install.python-poetry.org | python3 -
    
  2. Clone the repository:

    git clone git@github.com:aliezzahn/balue.git
    cd balue
    
  3. Install the dependencies:

    poetry install
    

Manual Installation

  1. Clone the repository:

    git clone git@github.com:aliezzahn/balue.git
    cd balue
    
  2. Install the dependencies using pip:

    pip install -r requirements.txt
    

Usage

Encryption and Decryption Example

Here's how you can use the ComplexEncryptor class to encrypt and decrypt a message.

  1. Create an encryptor instance with a secret key.
  2. Encrypt a plaintext message.
  3. Decrypt the ciphertext to get back the original message.
from balue.encryptor import ComplexEncryptor

# Initialize the encryptor with a secret key
key = "super_secret_key"
encryptor = ComplexEncryptor(key)

# Define the plaintext to be encrypted
plaintext = "This is a very secret message!"

# Encrypt the plaintext
encrypted = encryptor.encrypt(plaintext)
print("Encrypted:", encrypted)

# Decrypt the ciphertext
decrypted = encryptor.decrypt(encrypted['ciphertext'], encrypted['indices'])
print("Decrypted:", decrypted)

Running the Test Script

To test the encryption and decryption process, you can run the provided test script.

python tests/test_encryptor.py

Project Structure

balue/
│
├── README.md
├── balue/
│   ├── __init__.py
│   └── encryptor.py
└── tests/
    └── test_encryptor.py
├── pyproject.toml

Security Considerations

This package is intended for educational purposes and should not be used for securing sensitive data in production environments. For real-world applications, rely on well-established cryptographic libraries and algorithms such as AES, RSA, and others provided by libraries like cryptography, PyCrypto, or PyCryptodome.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request on GitHub.

Acknowledgments

  • Inspired by classical encryption techniques and the need to understand basic cryptographic principles.

Metadata

Release files for balue 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for balue 0.1.0
File Size Uploaded
balue-0.1.0.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for balue 0.1.0
File Interpreter ABI Platform
balue-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.4 kB

Release files / balue-0.1.0.tar.gz

Download URL balue-0.1.0.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b40125ba2d7217e9ed94a4bc0c0639390106f7b6af2d6023298e9c362d7ea35e
BLAKE2b-256 checksum
How to use checksums
7e2071faa3f297ac01153c29ffa81046132d1c56a5008f6917733ae24fb5114e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.0rc1 Linux/6.5.0-35-generic

Release files / balue-0.1.0-py3-none-any.whl

Download URL balue-0.1.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1537292f3ee088a18909ec572d68de56e9c61a8961f8bab120d3eb4a3f800db1
BLAKE2b-256 checksum
How to use checksums
b971191a1942aec9433306c9a9767b0ab00453df0a0f362e373d94c77d9aa246
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.3 CPython/3.11.0rc1 Linux/6.5.0-35-generic

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page