# 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:
```bash
pip install atom-encryption
```
Or clone the repository and install it locally:
```bash
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.
```python
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
```python
from atom_encryption.error_detection_tools import ErrorDetectionTools
# Example: BCC
bcc = ErrorDetectionTools.BCC.generate(b"123456789")
print("BCC:", bcc)
```
### Irreversible Encryption Tools
```python
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
```python
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:
```bash
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](https://github.com/alfredzhang98/atom_sdk/tree/master/atom_encryption)
```bash
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:
```bash
pip install build twine
```
### Step 2: Build the Package
Build the source distribution and wheel:
```bash
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:
```bash
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/alfredzhang98/atom_sdk/tree/master/atom_encryption",
"name": "atom-encryption",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "encryption, AES, RSA, ECC, cryptography, security",
"author": "alfred",
"author_email": "alfred.zhang98@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fd/4d/f5f29152c0f075686a47d605acbb3fe52de8e14e647706518d119eee6b17/atom_encryption-1.2.0.tar.gz",
"platform": null,
"description": "# Atom Encryption Library\r\n\r\nAtom 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.\r\n\r\n---\r\n\r\n# CHANGELOG\r\n\r\n## [1.2.0] - 20924/12/27\r\n### Added\r\n- **Type Encoding and Decoding Tools**:\r\n - Added `TypeEncodeDecodeTools` class with various utility methods:\r\n - `int_list_to_str` and `str_to_int_list`: Convert between integer lists and strings.\r\n - `float_to_bytes` and `bytes_to_float`: Convert between floats and bytes.\r\n - `hex_string_format_to_bytes` and `bytes_to_hex_string_format`: Handle hex string and byte conversions.\r\n - `int_to_int_list` and `int_list_to_int`: Convert integers to byte lists with MSB/LSB ordering and back.\r\n - Other similar encoding/decoding tools.\r\n- Comprehensive unit tests for the new `TypeEncodeDecodeTools` in `test_type_encode_decode_tools.py`.\r\n\r\n### Fixed\r\n- None\r\n\r\n---\r\n\r\n## Features\r\n\r\n- **Error Detection Tools**: Implementations of BCC, CRC, Parity Check, and LRC for data integrity checks.\r\n- **Irreversible Encryption**: Secure hashing algorithms like SHA-256, SHA-512, and bcrypt.\r\n- **Reversible Encryption**: Symmetric and asymmetric encryption algorithms including AES, Twofish, RSA, and ECC.\r\n- **Type Encoding and Decoding**: Tools for type conversion and encoding/decoding operations, such as integer-to-string, hex-to-bytes, and more.\r\n\r\n---\r\n\r\n## Installation\r\n\r\nYou can install Atom Encryption from PyPI:\r\n\r\n```bash\r\npip install atom-encryption\r\n```\r\n\r\nOr clone the repository and install it locally:\r\n\r\n```bash\r\ngit clone https://github.com/yourusername/atom-encryption.git\r\ncd atom-encryption\r\npip install .\r\n```\r\n\r\n---\r\n\r\n## Usage\r\n\r\n### Type Encode Decode Tools\r\n\r\nThe `TypeEncodeDecodeTools` module provides utilities for various type conversions, such as integer lists to strings, bytes to floats, and more.\r\n\r\n```python\r\nfrom atom_encryption.type_encode_decode_tools import TypeEncodeDecodeTools\r\n\r\ntools = TypeEncodeDecodeTools()\r\n\r\n# Example 1: Integer list to string and back\r\nint_list = [72, 101, 108, 108, 111]\r\nstring = tools.int_list_to_str(int_list)\r\nprint(\"String:\", string) # Output: \"Hello\"\r\nprint(\"Back to Integer List:\", tools.str_to_int_list(string)) # Output: [72, 101, 108, 108, 111]\r\n\r\n# Example 2: Float to bytes and back\r\nfloat_value = 12.34\r\nfloat_bytes = tools.float_to_bytes(float_value)\r\nprint(\"Bytes:\", float_bytes)\r\nprint(\"Float:\", tools.bytes_to_float(float_bytes))\r\n\r\n# Example 3: Hex string format to bytes\r\nbyte_data = b\"Hello\"\r\nformatted_hex = tools.bytes_to_hex_string_format(byte_data)\r\nprint(\"Hex String Format:\", formatted_hex) # Output: \"\\x48\\x65\\x6c\\x6c\\x6f\"\r\nprint(\"Bytes:\", tools.hex_string_format_to_bytes(formatted_hex)) # Output: b\"Hello\"\r\n\r\n# Example 4: Integer to integer list with MSB ordering\r\ninteger_value = 123456\r\nint_list = tools.int_to_int_list(integer_value, specified_length=4, order=\"msb\")\r\nprint(\"Integer List (MSB):\", int_list) # Output: [0, 1, 226, 64]\r\nprint(\"Back to Integer:\", tools.int_list_to_int(int_list, \"msb\")) # Output: 123456\r\n```\r\n\r\n### Error Detection Tools\r\n\r\n```python\r\nfrom atom_encryption.error_detection_tools import ErrorDetectionTools\r\n\r\n# Example: BCC\r\nbcc = ErrorDetectionTools.BCC.generate(b\"123456789\")\r\nprint(\"BCC:\", bcc)\r\n```\r\n\r\n### Irreversible Encryption Tools\r\n\r\n```python\r\nfrom atom_encryption.irreversible_encryption_tools import IrreversibleEncryptionTools\r\n\r\n# Example: SHA-256 Hashing\r\nhashed_data = IrreversibleEncryptionTools.Hash.hash_data(\"HelloWorld\", algorithm=\"sha256\")\r\nprint(\"SHA-256 Hash:\", hashed_data)\r\n```\r\n\r\n### Reversible Encryption Tools\r\n\r\n```python\r\nfrom atom_encryption.reversible_encryption_tools import ReversibleEncryptionTools\r\n\r\n# Example: AES Encryption\r\naes_tool = ReversibleEncryptionTools.AES()\r\naes_tool.generate_key()\r\nkey = aes_tool.load_key()\r\nencrypted = aes_tool.encrypt_data(\"Hello AES\", key)\r\ndecrypted = aes_tool.decrypt_data(encrypted, key)\r\nprint(\"Decrypted:\", decrypted)\r\n```\r\n\r\n---\r\n\r\n## Development\r\n\r\n### Requirements\r\n\r\nBefore you begin, ensure you have the following installed:\r\n\r\n- Python 3.8 or higher\r\n- pip\r\n\r\nInstall the dependencies:\r\n\r\n```bash\r\npip install -r requirements.txt\r\n```\r\n\r\n### Running Tests\r\n\r\nTo run the test, please clone the Github project and run the could below:\r\nGithub link: [atom_encryption](https://github.com/alfredzhang98/atom_sdk/tree/master/atom_encryption)\r\n\r\n```bash\r\npython -m unittest discover test\r\n```\r\n\r\n---\r\n\r\n## Building and Uploading to PyPI\r\n\r\n### Step 1: Install Build Tools\r\n\r\nMake sure you have the required tools for building and uploading:\r\n\r\n```bash\r\npip install build twine\r\n```\r\n\r\n### Step 2: Build the Package\r\n\r\nBuild the source distribution and wheel:\r\n\r\n```bash\r\npython -m build\r\n```\r\n\r\nThis will generate the `dist/` folder containing `.tar.gz` and `.whl` files.\r\n\r\n### Step 3: Upload to PyPI\r\n\r\nUpload the package to PyPI using Twine:\r\n\r\n```bash\r\ntwine upload dist/*\r\n```\r\n\r\nYou will be prompted to enter your PyPI credentials. Once done, your package will be live on PyPI.\r\n\r\n---\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\r\n\r\n---\r\n\r\n## Contributing\r\n\r\nContributions are welcome! If you have ideas for improvements or new features, feel free to fork the repository and submit a pull request.\r\n\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python library for reversible and irreversible encryption tools.",
"version": "1.2.0",
"project_urls": {
"Homepage": "https://github.com/alfredzhang98/atom_sdk/tree/master/atom_encryption"
},
"split_keywords": [
"encryption",
" aes",
" rsa",
" ecc",
" cryptography",
" security"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c086787a44020ca39b3a77e1481472b35aea2aad422bcbdf0ef605ab5b7a9932",
"md5": "0acddf6690d283d615f7a46c419708be",
"sha256": "f2c1f7627879c0ddc87a76c68df451ada314c890862e9ba6824520fed9ae1838"
},
"downloads": -1,
"filename": "atom_encryption-1.2.0-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "0acddf6690d283d615f7a46c419708be",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.8",
"size": 13553,
"upload_time": "2024-12-27T18:43:15",
"upload_time_iso_8601": "2024-12-27T18:43:15.438525Z",
"url": "https://files.pythonhosted.org/packages/c0/86/787a44020ca39b3a77e1481472b35aea2aad422bcbdf0ef605ab5b7a9932/atom_encryption-1.2.0-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fd4df5f29152c0f075686a47d605acbb3fe52de8e14e647706518d119eee6b17",
"md5": "dc832b3764482bce346c8ba743ddccf0",
"sha256": "063605b682f876f27e3c8438c72a69294def081ce7aac6879f191008b7b39d05"
},
"downloads": -1,
"filename": "atom_encryption-1.2.0.tar.gz",
"has_sig": false,
"md5_digest": "dc832b3764482bce346c8ba743ddccf0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 16352,
"upload_time": "2024-12-27T18:43:17",
"upload_time_iso_8601": "2024-12-27T18:43:17.670216Z",
"url": "https://files.pythonhosted.org/packages/fd/4d/f5f29152c0f075686a47d605acbb3fe52de8e14e647706518d119eee6b17/atom_encryption-1.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-27 18:43:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alfredzhang98",
"github_project": "atom_sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "atom-encryption"
}