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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

crypto_toolkit_py-1.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crypto_toolkit_py-1.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file crypto_toolkit_py-1.1.0.tar.gz.

File metadata

  • Download URL: crypto_toolkit_py-1.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.5

File hashes

Hashes for crypto_toolkit_py-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cd0b199488b81dc3c742d3fa8730fd6db50fa05a51b10e16ea137e28ecc5bff5
MD5 73138abf90733a3e9f46e1a35001f126
BLAKE2b-256 871b58fe3d3cd444e905933222e2312c00230bd41c387170da2fadec622b381e

See more details on using hashes here.

File details

Details for the file crypto_toolkit_py-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for crypto_toolkit_py-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe9cab96cd363925929e87d4e1ad86dc88318455bb1925a4a09803bac5621ad2
MD5 f4599ad99f673a69e4cfe9b460dae664
BLAKE2b-256 4f2caa6a9300056dffe8bc3edf4c52975991a0694539dc94ee58b5f8130a4cd8

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 files

1.0.1

2 files

1.0.0

2 files

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