Skip to main content

A module for cryptography built from scratch, offering a robust suite of classes and functions for symmetric and asymmetric encryption, hashing algorithms, key exchange protocols as well as mathematical utility functions.

Project description

๐šŒ๐š›๐šข๐š™๐š๐š˜๐šœ๐šข๐šœ๐š๐šŽ๐š–๐šœ

Licence Python Wheel Maintained OS Documentation Status

Overview

The cryptosystems package offers a robust suite of classes and functions for symmetric and asymmetric encryption, hashing algorithms, key exchange protocols as well as mathematical utility functions. Designed for seamless encryption, decryption, and cryptographic operations, this package is lightweight and efficient, relying solely on Pythonโ€™s built-in libraries: ctypes, warnings and hashlib. With almost all of the cryptographic logic implemented from scratch, cryptosystems provides a streamlined, dependency-free solution, ensuring consistency and reliability across different environments as well as Python versions.

๐Ÿ“œ Changelog for cryptosystems v1.0.0 ๐Ÿ“œ

  • ๐Ÿš€ Improved Performance with GMP ๐Ÿš€: Optimized performance using GMP for faster computations.
  • ๐Ÿงฉ Modularized Codebase ๐Ÿงฉ: Refactored the codebase to be more modular for better maintainability and scalability.
  • ๐Ÿ”„ Updated Function Interfaces for Asymmetric Cryptosystems ๐Ÿ”„: Revised function interfaces, with added generate_keys functionality.
  • ๐Ÿ“ API Documentation Created ๐Ÿ“: Comprehensive API documentation has been created to assist with the usage of cryptosystems, covering cryptosystem description, mathematical details, usage examples and more.
  • ๐Ÿ› ๏ธ Modified Rabin implementation ๐Ÿ› ๏ธ: Modified Rabin implementation with added functionality to verify plaintext using SHA-256 hash.
  • ๐Ÿ”ง Fixed ElGamal errors ๐Ÿ”ง: Corrected the ElGamal implementation with a newly added find_generator function.
  • ๐ŸŒ€ Extended Support for ECC Curves ๐ŸŒ€: Added support for additional ECC curves, including Montgomery curves.
  • ๐Ÿ” SHA-512 Wrapper Added ๐Ÿ”: Added a wrapper for the SHA-512 algorithm to the hash_functions submodule.

Key Features

  • Dependency-Free ๐Ÿšซ๐Ÿ“ฆ: Operates solely on Python's built-in modules, eliminating the need for external libraries.
  • Version Stability ๐Ÿ”’๐Ÿ“…: Crafted to maintain consistent functionality across Python versions.
  • Optimized for Performance โšกโš™๏ธ: Built from scratch for efficient and consistant cryptographic operations.
  • Lightweight Codebase ๐Ÿชถ๐Ÿ’ป: Minimalistic design ensures a low overhead and straightforward integration.
  • Reliability and Security ๐Ÿ”๐Ÿ›ก๏ธ: Ensures robust encryption/decryption and hashing without reliance on third-party modules.
  • Comprehensive Cryptosystem Support ๐Ÿ”„๐Ÿ”‘: Offers a full suite of symmetric, asymmetric, and hashing methods.

Installation

To install the package, simply clone the repository and install the dependencies:

pip install cryptosystems

Usage

The general structure for usage is to create an object of the respective cryptosystem, with the key as argument if required. Similar usage for the utility functions as well. See docs for the exact reference example of a specific cryptosystem if required.

from cryptosystems import SomeCryptosystem

cipher = SomeCryptosystem()
ciphertext = cipher.encrypt("Hello World")
print(ciphertext)  # Output: 'ciphertext string'
plaintext = cipher.decrypt(ciphertext)
print(plaintext)  # Output: 'Hello World'

License

This project is licensed under the Apache License - see the LICENSE file for details.

Authors

  • Ishan Surana - Inception, implementation and testing - GitHub

Acknowledgments

  • PyCryptodome, for the logic of functions in the functions submodule (Python-based implementation, discontinued from version v1.x onward)
  • bcrypt.h and gmp.h, for functions in the functions submodule

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cryptosystems-1.0.0.tar.gz (423.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cryptosystems-1.0.0-py3-none-any.whl (424.9 kB view details)

Uploaded Python 3

File details

Details for the file cryptosystems-1.0.0.tar.gz.

File metadata

  • Download URL: cryptosystems-1.0.0.tar.gz
  • Upload date:
  • Size: 423.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for cryptosystems-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3d287dcc6385dfd2578aaa8ca492b4c1ef9c4803e6f37ee5a0bc1706afb7b391
MD5 c360afd4100907071c9b392ffbfd3122
BLAKE2b-256 a942a9907d0a1050ee22c7354035d9527f400f8148b4d994b1ac3bbb38053ef3

See more details on using hashes here.

File details

Details for the file cryptosystems-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cryptosystems-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 424.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for cryptosystems-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a7aa21601f2175e6452b5ecf3c35f0c59ad2dfb6b5fede34430696d3e50347b
MD5 5f9f335f5c5eab5486f759fb3b6c952c
BLAKE2b-256 5db1cbbbc7ef787b0d208c0341f7fbe6b26e373fd8de122dc53332ed1324533c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page