Modern Cryptography & Hashing Toolkit (Python)
A misuse-resistant, high-level cryptography library with safe defaults, constant-time verification, and a clear API for hashing, password hashing, key derivation, symmetric encryption, HMAC, and digital signatures.
Features
- Safe hashing: SHA-256, SHA-384, SHA-512, SHA-3, BLAKE2 (MD5 and SHA-1 rejected)
- HMAC: Constant-time verification
- Password hashing: PBKDF2-SHA256, scrypt, Argon2id, bcrypt with adaptive costs
- Key derivation: PBKDF2 and scrypt
- Symmetric encryption: AES-256-GCM or ChaCha20-Poly1305 with automatic nonce management
- Digital signatures: Ed25519
- Zero runtime dependencies for core hashing, HMAC, and key derivation
- Optional extras for AEAD encryption and signatures (
[crypto]), Argon2id ([argon2]), and bcrypt ([bcrypt])
Installation
pip install crypto-toolkit-py
With all optional dependencies:
pip install "crypto-toolkit-py[full]"
Quick Start
from crypto_toolkit import hash, password, encrypt, sign
# Safe, deterministic hashing
sha256 = hash.string('hello world', algorithm='sha-256')
print(sha256)
mac = hash.hmac('secret-key', 'message', algorithm='sha-256')
assert hash.verify_hmac(mac, 'secret-key', 'message', algorithm='sha-256')
# Password hashing
ph = password.hash('user-password')
assert password.verify('user-password', ph)
# Key derivation
salt = b'16-or-more-random-bytes'
key = password.derive('passphrase', salt=salt, length=32)
# Symmetric encryption (requires cryptography)
ciphertext = encrypt.symmetric('sensitive data', key=key)
plaintext = encrypt.decrypt(ciphertext, key=key)
assert plaintext == 'sensitive data'
# Digital signatures (requires cryptography)
private_key, public_key = sign.generate_keypair()
signature = sign.ed25519('message', private_key=private_key)
assert sign.verify(signature, 'message', public_key=public_key)
Development
cd implementations/security/crypto-toolkit/python
pip install -e ".[dev,full]"
pytest test_crypto_toolkit.py -v
License
MIT License
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file crypto_toolkit_py-1.0.1.tar.gz.
File metadata
- Download URL: crypto_toolkit_py-1.0.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a8608e728058a3583586e957027a1712c6e01d30ac2168ddfb64eed40ef8e9c
|
|
| MD5 |
6013bc5d7e56893c4560f22424a4273f
|
|
| BLAKE2b-256 |
d009d097baf1304fcf0b7b91d172216486ed1b52225a1a759593fe71c39ab5ca
|
File details
Details for the file crypto_toolkit_py-1.0.1-py3-none-any.whl.
File metadata
- Download URL: crypto_toolkit_py-1.0.1-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7ae8c23f93e28f4c5ca4ddc0a1fe393bf3f1283f2e7a6a52550fc360c30891b
|
|
| MD5 |
f07a7c058c2df1a322ac038197f8f0b4
|
|
| BLAKE2b-256 |
1a848d1efb0a4bfd5246dbfd292d264961b7d837a31870c8bfd67ae42f6f9ba3
|