
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Hash Forge is a lightweight Python library designed to simplify the process of hashing and verifying data using a variety of secure hashing algorithms.
Hash Forge is a lightweight Python library designed to simplify the process of hashing and verifying data using a variety of secure hashing algorithms.
Hash Forge is a flexible and secure hash management tool that supports multiple hashing algorithms. This tool allows you to hash and verify data using popular hash algorithms, making it easy to integrate into projects where password hashing or data integrity is essential.
pip install hash-forge
Hash Forge provides optional dependencies for specific hashing algorithms. To install these, use:
bcrypt support:
pip install "hash-forge[bcrypt]"
Argon2 support:
pip install "hash-forge[argon2]"
Whirlpool and RIPEMD-160 support:
pip install "hash-forge[crypto]"
Blake3 support:
pip install "hash-forge[blake3]"
from hash_forge import HashManager
from hash-forge.hashers import PBKDF2Hasher
# Initialize HashManager with PBKDF2Hasher
hash_manager = HashManager(PBKDF2Hasher())
# Hash a string
hashed_value = hash_manager.hash("my_secure_password")
# Verify the string against the hashed value
is_valid = hash_manager.verify("my_secure_password", hashed_value)
print(is_valid) # Outputs: True
# Check if the hash needs rehashing
needs_rehash = hash_manager.needs_rehash(hashed_value)
print(needs_rehash) # Outputs: False
Note: The first hasher provided during initialization of
HashManager
will be the preferred hasher used for hashing operations, though any available hasher can be used for verification.
Currently supported hashers:
You can initialize HashManager
with one or more hashers:
from hash_forge import HashManager
from hash_forge.hashers import (
Argon2Hasher,
BCryptSha256Hasher,
Blake2Hasher,
PBKDF2Sha256Hasher,
Ripemd160Hasher,
ScryptHasher,
WhirlpoolHasher,
Blake3Hasher
)
hash_manager = HashManager(
PBKDF2Sha256Hasher(iterations=150_000),
BCryptSha256Hasher(),
Argon2Hasher(),
ScryptHasher(),
Ripemd160Hasher(),
Blake2Hasher('MySecretKey'),
WhirlpoolHasher(),
Blake3Hasher()
)
Use the verify
method to compare a string with its hashed counterpart:
is_valid = hash_manager.verify("my_secure_password", hashed_value)
You can check if a hash needs to be rehashed (e.g., if the hashing algorithm parameters are outdated):
needs_rehash = hash_manager.needs_rehash(hashed_value)
Contributions are welcome! Please feel free to submit issues or pull requests to help improve the project.
This project is licensed under the MIT License.
FAQs
Hash Forge is a lightweight Python library designed to simplify the process of hashing and verifying data using a variety of secure hashing algorithms.
We found that hash-forge demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.