A secure password hashing system that implements various cryptographic techniques to securely store and verify passwords.
This Python-based password security system provides robust mechanisms for password storage and verification using industry-standard cryptographic algorithms. The system implements salting and hashing techniques to protect passwords from various attacks, including rainbow table attacks and brute force attempts.
- Multiple cryptographic algorithm (SHA-256, SHA-512, etc.)
- Custom salting implementation for enhanced security
- Customizable
- Configurable salt length and password limits
- Simple interface for storing and verifying passwords
# Clone the repository
git clone https://github.com/stzyium/saltforge
# Navigate to the project directory
cd saltforge
python SecurePassword.py
# No external dependencies required - uses standard Python librariesThe system uses a custom salting mechanism that interleaves random characters with the password characters:
- A random salt of configurable length is generated
- The salt is interleaved with the password characters
- The resulting string is hashed using the selected algorithm
This approach makes the system resilient against dictionary attacks and rainbow table attacks.
The system supports two security levels:
- Level 1: Basic salting and hashing
- Level 2: Enhanced security using double salting and PBKDF2 (Password-Based Key Derivation Function 2)
Password verification works by:
- Reconstructing the salted password using the stored salt
- Hashing the reconstructed password
- Comparing the computed hash with the stored hash
from SecurePassword import Store, Fetch, Data
# Store a password
password = "MySecurePassword123"
Store(password, algorithm='sha256', SecurityLevel=2)
# Verify a password
password = "wrongAttemptedPassword"
result, message = Fetch(password, **Data)
if result:
print("Authentication successful!")
else:
print("Authentication failed!")Stores a password securely using salting and hashing.
Parameters:
text(str): The password to storealgorithm(str, optional): Hashing algorithm to use. Default is 'sha256'SecurityLevel(int, optional): Security level (1 or 2). Default is 1
Verifies a password against stored credentials.
Parameters:
text(str): The password to verify**kwargs: Additional parameters including salt and stored hash
Returns:
tuple: (status_code, message) where status_code is 1 for success, 0 for failure
Provides methods for salting and verifying salted passwords:
MixSalt(text, limit=32, saltQ=64): Creates a salted version of the input textCheckSalt(**kwargs): Reconstructs a salted password for verification
Provides methods for hashing passwords:
hash(text, algorithm, Na=None, _iter=100000): Hashes input text using specified algorithm
- The system uses built-in Python cryptographic functions which are well-tested
- Increase iterations for PBKDF2 for additional security (with performance trade-offs)
- Supported algorithms are from Python's hashlib.algorithms_guaranteed
MIT License
© 2025 stzyium