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

Uploaded Python 3

File details

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

File metadata

  • Download URL: crypto_toolkit_py-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 fa7600579dbe8c5d47548e1ffdbe151076e41497e08f01222f48f2a5376e2752
MD5 c9cfbfa88647234d751c02d8cc9d9a12
BLAKE2b-256 8c4aaae036b37f64d34a3cfaaa83173472ee98d475c64d19ac47f4e76c67f7d3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for crypto_toolkit_py-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29e8106bafa5f81d666c7bc020e9951aa12eb3bf9826cb7cbcf4dbff9bf7a59a
MD5 5d295f1b8fe6860eb245ba93886fcc39
BLAKE2b-256 e91edfe0805b7c4ac34866afbb98756617e5a85b72249ec9317188176ff1ae20

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.0

2 files

1.0.1

2 files

This release

1.0.0 This release

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