A Python library for cryptographic operations that secures data, encrypts files, protects passwords, sends secret messages, and hides text in images.
- Password Hashing: Turn passwords into secure hashes using PBKDF2 with salt
- Password Verification: Check if entered passwords match stored hashes
- Password Generation: Create random passwords with letters, numbers, and symbols
- AES File Encryption: Encrypt files using AES-256 in GCM mode
- Password-Based Encryption: Uses PBKDF2 to turn passwords into encryption keys
- Automatic File Handling: Creates .enc files and restores original files
- SHA-256 Hashing: Create SHA-256 hashes for data verification
- Hash Verification: Check if data matches its expected hash
- Simple Hash Comparison: Quick way to detect data changes
- AES Message Encryption: Encrypt text messages using AES-256-GCM
- Key-Based Encryption: Requires 32-byte keys for encryption/decryption
- Base64 Output: Encrypted messages are returned as readable text strings
- LSB Steganography: Hide text messages in image pixels using least significant bits
- PNG/Image Support: Works with images that PIL can open (PNG, JPEG, etc.)
- Invisible Messages: Messages are hidden without noticeable visual changes
- Python 3.7 or higher
- Dependencies:
pycryptodome>= 3.0.0Pillow>= 8.0.0
pip install cypherkitgit clone https://github.com/FahimDidnt/CypherKit.git
cd CypherKit
pip install -e .git clone https://github.com/FahimDidnt/CypherKit.git
cd CypherKit
pip install -e ".[dev]"from cypherkit import hash_password, verify_password, generate_password
# Hash a password securely
password = "my_secure_password"
hashed = hash_password(password)
print(f"Hashed: {hashed}")
# Verify password
is_valid = verify_password(hashed, password)
print(f"Password valid: {is_valid}") # True
# Generate a secure random password
random_password = generate_password(length=16, include_symbols=True)
print(f"Generated password: {random_password}")from cypherkit import encrypt_file, decrypt_file
# Encrypt a file
try:
encrypt_file('sensitive_data.txt', 'strong_password_123')
print("File encrypted successfully!")
except Exception as e:
print(f"Encryption failed: {e}")
# Decrypt a file
try:
decrypt_file('sensitive_data.txt.enc', 'strong_password_123')
print("File decrypted successfully!")
except Exception as e:
print(f"Decryption failed: {e}")from cypherkit import generate_hash, verify_hash
# Generate hash for data integrity
data = "Important document content"
hash_value = generate_hash(data)
print(f"Hash: {hash_value}")
# Verify data integrity
is_valid = verify_hash(data, hash_value)
print(f"Data integrity valid: {is_valid}") # Truefrom cypherkit import encrypt_message, decrypt_message
import os
# Generate a secure encryption key
encryption_key = os.urandom(32) # 256-bit key
# Encrypt a message
message = "This is a confidential message"
encrypted_data = encrypt_message(message, encryption_key)
print("Message encrypted successfully!")
# Decrypt the message
decrypted_message = decrypt_message(encrypted_data, encryption_key)
print(f"Decrypted: {decrypted_message}")from cypherkit import encode_message, decode_message
# Hide a message in an image
secret_message = "This message is hidden in the image"
try:
encode_message('cover_image.png', secret_message, 'stego_image.png')
print("Message successfully hidden in image!")
except Exception as e:
print(f"Steganography encoding failed: {e}")
# Extract the hidden message
try:
extracted_message = decode_message('stego_image.png')
print(f"Hidden message: {extracted_message}")
except Exception as e:
print(f"Steganography decoding failed: {e}")cypherkit/
βββ cypherkit/
β βββ __init__.py
β βββ password.py
β βββ file_crypto.py
β βββ hashing.py
β βββ communication.py
β βββ steganography.py
βββ tests/
β βββ test_password.py
β βββ test_file_crypto.py
β βββ test_hashing.py
β βββ test_communication.py
β βββ test_steganography.py
βββ README.md
βββ LICENSE
βββ setup.py
- PBKDF2 Password Hashing: Uses 100,000 iterations with random salt for password protection
- AES-256-GCM Encryption: Strong encryption with built-in authentication for files and messages
- Secure Random Generation: Uses Python's
secretsmodule for cryptographically strong randomness - Salt Protection: Automatic random salt generation prevents rainbow table attacks
- Key Derivation: PBKDF2 safely converts passwords into encryption keys
Run the test suite to ensure everything works correctly:
# Run all tests
python -m pytest tests/
# Run tests with coverage
python -m pytest tests/ --cov=cypherkit
# Run specific test module
python -m pytest tests/test_password.py -vI welcome contributions! Fork the repo, make your changes, and submit a pull request. Please report bugs and suggest features through GitHub issues.
- Fork the repository
- Create a virtual environment:
python -m venv venv - Activate it:
source venv/bin/activate(Linux/Mac) orvenv\Scripts\activate(Windows) - Install development dependencies:
pip install -e ".[dev]" - Run tests:
python -m pytest
Please report bugs and feature requests through GitHub Issues.
This project is licensed under the MIT License - see the LICENSE file for details.