Cryptography Library
A Python library for implementing and working with various classical encryption algorithms. This library provides a collection of ciphers that you can use to encrypt and decrypt data in educational or practical cryptography-related projects.
Features
This library includes the following classical ciphers:
- Caesar Cipher: A substitution cipher that shifts letters by a fixed number.
- Monoalphabetic Cipher: A substitution cipher where each character is replaced by another character using a key.
- Vigenere Cipher: A polyalphabetic substitution cipher that uses a keyword to encrypt data.
- Vernam Cipher: A stream cipher that uses a key of the same length as the plaintext for encryption.
- Playfair Cipher: A digraph substitution cipher that encrypts pairs of letters.
- Hill Cipher: A cipher based on linear algebra that uses matrix multiplication for encryption.
Installation
You can install this library using pip:
pip install CryptoClasec
Usage
Here’s how to use the library in your Python project:
Import the Cipher Classes
from CryptoClasec import Caesar, Monoalphabetic, Vigenere, Vernam, Playfair, HillCipher
Example: Caesar Cipher
# Initialize the Caesar cipher with a shift value of 3
caesar = Caesar(3)
# Encrypt a plaintext
encrypted = caesar.encrypt("HELLO")
print("Encrypted text:", encrypted)
# Decrypt the ciphertext
decrypted = caesar.decrypt(encrypted)
print("Decrypted text:", decrypted)
Example: Vigenere Cipher
# Initialize the Vigenere cipher with a keyword
vigenere = Vigenere("KEY")
# Encrypt a plaintext
encrypted = vigenere.encrypt("HELLO")
print("Encrypted text:", encrypted)
# Decrypt the ciphertext
decrypted = vigenere.decrypt(encrypted)
print("Decrypted text:", decrypted)
Available Classes
1- Caesar:
caesar = Caesar(3)
caesar.encrypt(plaintext)
caesar.decrypt(ciphertext)
2- Monoalphabetic:
mono = Monoalphabetic("QWERTYUIOPLKJHGFDSAZXCVBNM")
mono.encrypt(plaintext)
mono.decrypt(ciphertext)
2- Vigenere:
vigenere = Vigenere("KEY")
vigenere.encrypt(plaintext)
vigenere.decrypt(ciphertext)
4- Vernam:
vernam = Vernam("RANDOMKEY")
vernam.encrypt(plaintext)
vernam.decrypt(ciphertext)
5- Playfair:
playfair = Playfair("KEYWORD")
playfair.encrypt(plaintext)
playfair.decrypt(ciphertext)
6- HillCipher:
hill = HillCipher([[2, 3], [1, 4]])
hill.encrypt(plaintext)
hill.decrypt(ciphertext)
License
This library is licensed under the MIT License. See the LICENSE file for more information.
Contributing
Contributions are welcome! Feel free to submit issues or pull requests to improve the library.
Author
Created by Ibrahem abo kila. For any inquiries, please contact me at ibrahemabokila@gmail.com.
Metadata
Release files for CryptoClasec 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cryptoclasec-1.0.2.tar.gz | 6.7 kB | Without provenance | Details for cryptoclasec-1.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| CryptoClasec-1.0.2-py3-none-any.whl | Python 3 | none | any | Details for CryptoClasec-1.0.2-py3-none-any.whl |
Total release size: 16.2 kB
Release files / cryptoclasec-1.0.2.tar.gz
| Download URL | cryptoclasec-1.0.2.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5fbbd53d5c2be3930767a535e2c51a66b599ea2dc6b11a12eaa0385d37e1ed5b
|
|
BLAKE2b-256 checksum How to use checksums |
8de1be1ab16a001d45fb7b60197730db5e3adb83685fda1e02b8635c4dba7fd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.0
|
Release files / CryptoClasec-1.0.2-py3-none-any.whl
| Download URL | CryptoClasec-1.0.2-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
66003196390c0198971c2044ba3266964a6095647f823f4e62b0074d02242f1e
|
|
BLAKE2b-256 checksum How to use checksums |
f6c85ff5c50d9ad0fc6812c8c1b1c80d1c6bf0ab95baa25cb96d3cd6cedf6dbb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.0
|
Security for CryptoClasec 1.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.