Skip to content

The πšŒπš›πš’πš™πšπš˜πšœπš’πšœπšπšŽπš–πšœ package offers a suite of classes and functions for both symmetric and asymmetric encryption, signature-verification, hashing algorithms, key exchange protocols as well as mathematical utility functions. Docs at https://cryptosystems.readthedocs.io.

License

Notifications You must be signed in to change notification settings

ishan-surana/cryptosystems

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πšŒπš›πš’πš™πšπš˜πšœπš’πšœπšπšŽπš–πšœ

Licence Python Wheel Maintained OS Documentation Status

Overview

The cryptosystems package offers a 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.

Warning

As of now, this library stands as a personal project of mine. It has not been audited by any authority. It also contains many basic symmetric ciphers, which should be used ONLY for educational purposes, and NOT in production. The same point stands for other cryptosystems due to appropriate padding schemes not formed yet, and the project not having been formally verified. Please do not use this library in production until it is audited and certified.

πŸ“œ 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

About

The πšŒπš›πš’πš™πšπš˜πšœπš’πšœπšπšŽπš–πšœ package offers a suite of classes and functions for both symmetric and asymmetric encryption, signature-verification, hashing algorithms, key exchange protocols as well as mathematical utility functions. Docs at https://cryptosystems.readthedocs.io.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published