Skip to main content

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

Metadata

Release files for crypto-toolkit-py 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crypto-toolkit-py 1.1.0
File Size Uploaded Provenance
crypto_toolkit_py-1.1.0.tar.gz 12.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for crypto-toolkit-py 1.1.0
File Interpreter ABI Platform
crypto_toolkit_py-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.5 kB

Release files / crypto_toolkit_py-1.1.0.tar.gz

Download URL crypto_toolkit_py-1.1.0.tar.gz
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
cd0b199488b81dc3c742d3fa8730fd6db50fa05a51b10e16ea137e28ecc5bff5
BLAKE2b-256 checksum
How to use checksums
871b58fe3d3cd444e905933222e2312c00230bd41c387170da2fadec622b381e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / crypto_toolkit_py-1.1.0-py3-none-any.whl

Download URL crypto_toolkit_py-1.1.0-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fe9cab96cd363925929e87d4e1ad86dc88318455bb1925a4a09803bac5621ad2
BLAKE2b-256 checksum
How to use checksums
4f2caa6a9300056dffe8bc3edf4c52975991a0694539dc94ee58b5f8130a4cd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Security for crypto-toolkit-py 1.1.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page