Skip to main content

Atom Encryption Library

Atom Encryption is a comprehensive Python library that provides tools for both reversible and irreversible encryption methods, as well as error detection mechanisms. It includes support for algorithms like AES, Twofish, RSA, ECC, and more.


CHANGELOG

[1.2.0] - 20924/12/27

Added

  • Type Encoding and Decoding Tools:
    • Added TypeEncodeDecodeTools class with various utility methods:
      • int_list_to_str and str_to_int_list: Convert between integer lists and strings.
      • float_to_bytes and bytes_to_float: Convert between floats and bytes.
      • hex_string_format_to_bytes and bytes_to_hex_string_format: Handle hex string and byte conversions.
      • int_to_int_list and int_list_to_int: Convert integers to byte lists with MSB/LSB ordering and back.
      • Other similar encoding/decoding tools.
  • Comprehensive unit tests for the new TypeEncodeDecodeTools in test_type_encode_decode_tools.py.

Fixed

  • None

Features

  • Error Detection Tools: Implementations of BCC, CRC, Parity Check, and LRC for data integrity checks.
  • Irreversible Encryption: Secure hashing algorithms like SHA-256, SHA-512, and bcrypt.
  • Reversible Encryption: Symmetric and asymmetric encryption algorithms including AES, Twofish, RSA, and ECC.
  • Type Encoding and Decoding: Tools for type conversion and encoding/decoding operations, such as integer-to-string, hex-to-bytes, and more.

Installation

You can install Atom Encryption from PyPI:

pip install atom-encryption

Or clone the repository and install it locally:

git clone https://github.com/yourusername/atom-encryption.git
cd atom-encryption
pip install .

Usage

Type Encode Decode Tools

The TypeEncodeDecodeTools module provides utilities for various type conversions, such as integer lists to strings, bytes to floats, and more.

from atom_encryption.type_encode_decode_tools import TypeEncodeDecodeTools

tools = TypeEncodeDecodeTools()

# Example 1: Integer list to string and back
int_list = [72, 101, 108, 108, 111]
string = tools.int_list_to_str(int_list)
print("String:", string)  # Output: "Hello"
print("Back to Integer List:", tools.str_to_int_list(string))  # Output: [72, 101, 108, 108, 111]

# Example 2: Float to bytes and back
float_value = 12.34
float_bytes = tools.float_to_bytes(float_value)
print("Bytes:", float_bytes)
print("Float:", tools.bytes_to_float(float_bytes))

# Example 3: Hex string format to bytes
byte_data = b"Hello"
formatted_hex = tools.bytes_to_hex_string_format(byte_data)
print("Hex String Format:", formatted_hex)  # Output: "\x48\x65\x6c\x6c\x6f"
print("Bytes:", tools.hex_string_format_to_bytes(formatted_hex))  # Output: b"Hello"

# Example 4: Integer to integer list with MSB ordering
integer_value = 123456
int_list = tools.int_to_int_list(integer_value, specified_length=4, order="msb")
print("Integer List (MSB):", int_list)  # Output: [0, 1, 226, 64]
print("Back to Integer:", tools.int_list_to_int(int_list, "msb"))  # Output: 123456

Error Detection Tools

from atom_encryption.error_detection_tools import ErrorDetectionTools

# Example: BCC
bcc = ErrorDetectionTools.BCC.generate(b"123456789")
print("BCC:", bcc)

Irreversible Encryption Tools

from atom_encryption.irreversible_encryption_tools import IrreversibleEncryptionTools

# Example: SHA-256 Hashing
hashed_data = IrreversibleEncryptionTools.Hash.hash_data("HelloWorld", algorithm="sha256")
print("SHA-256 Hash:", hashed_data)

Reversible Encryption Tools

from atom_encryption.reversible_encryption_tools import ReversibleEncryptionTools

# Example: AES Encryption
aes_tool = ReversibleEncryptionTools.AES()
aes_tool.generate_key()
key = aes_tool.load_key()
encrypted = aes_tool.encrypt_data("Hello AES", key)
decrypted = aes_tool.decrypt_data(encrypted, key)
print("Decrypted:", decrypted)

Development

Requirements

Before you begin, ensure you have the following installed:

  • Python 3.8 or higher
  • pip

Install the dependencies:

pip install -r requirements.txt

Running Tests

To run the test, please clone the Github project and run the could below: Github link: atom_encryption

python -m unittest discover test

Building and Uploading to PyPI

Step 1: Install Build Tools

Make sure you have the required tools for building and uploading:

pip install build twine

Step 2: Build the Package

Build the source distribution and wheel:

python -m build

This will generate the dist/ folder containing .tar.gz and .whl files.

Step 3: Upload to PyPI

Upload the package to PyPI using Twine:

twine upload dist/*

You will be prompted to enter your PyPI credentials. Once done, your package will be live on PyPI.


License

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


Contributing

Contributions are welcome! If you have ideas for improvements or new features, feel free to fork the repository and submit a pull request.

Metadata

Release files for atom-encryption 1.2.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 atom-encryption 1.2.0
File Size Uploaded
atom_encryption-1.2.0.tar.gz 16.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for atom-encryption 1.2.0
File Interpreter ABI Platform
atom_encryption-1.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 29.9 kB

Release files / atom_encryption-1.2.0.tar.gz

Download URL atom_encryption-1.2.0.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
063605b682f876f27e3c8438c72a69294def081ce7aac6879f191008b7b39d05
BLAKE2b-256 checksum
How to use checksums
fd4df5f29152c0f075686a47d605acbb3fe52de8e14e647706518d119eee6b17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.16

Release files / atom_encryption-1.2.0-py2.py3-none-any.whl

Download URL atom_encryption-1.2.0-py2.py3-none-any.whl
Size 13.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f2c1f7627879c0ddc87a76c68df451ada314c890862e9ba6824520fed9ae1838
BLAKE2b-256 checksum
How to use checksums
c086787a44020ca39b3a77e1481472b35aea2aad422bcbdf0ef605ab5b7a9932
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.16

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.1

2 release files

1.0.0

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