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.0.1.tar.gz (9.9 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.0.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

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

Hashes for crypto_toolkit_py-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5a8608e728058a3583586e957027a1712c6e01d30ac2168ddfb64eed40ef8e9c
MD5 6013bc5d7e56893c4560f22424a4273f
BLAKE2b-256 d009d097baf1304fcf0b7b91d172216486ed1b52225a1a759593fe71c39ab5ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crypto_toolkit_py-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f7ae8c23f93e28f4c5ca4ddc0a1fe393bf3f1283f2e7a6a52550fc360c30891b
MD5 f07a7c058c2df1a322ac038197f8f0b4
BLAKE2b-256 1a848d1efb0a4bfd5246dbfd292d264961b7d837a31870c8bfd67ae42f6f9ba3

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

2 files

This release

1.0.1 This release

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