cryptoserve-core
Pure cryptographic primitives for Python. Zero network dependencies, one pip install, production-ready defaults.
Installation
pip install cryptoserve-core
Quick Start
import cryptoserve_core as crypto
# Encrypt a string with a password
encrypted = crypto.encrypt_string("sensitive data", password="my-secret")
decrypted = crypto.decrypt_string(encrypted, password="my-secret")
# Hash a password (scrypt, PHC format)
hashed = crypto.hash_password("user-password")
assert crypto.verify_password("user-password", hashed)
# Create a JWT token
token = crypto.create_token({"sub": "user-123"}, key=b"my-secret-key-1234567890")
claims = crypto.verify_token(token, key=b"my-secret-key-1234567890")
Easy Encryption
Password-based encryption using PBKDF2 (600K iterations) + AES-256-GCM. Each call generates a fresh random salt and nonce.
from cryptoserve_core import encrypt, decrypt, encrypt_string, decrypt_string
# Bytes
ciphertext = encrypt(b"secret bytes", password="my-password")
plaintext = decrypt(ciphertext, password="my-password")
# Strings (returns URL-safe base64)
encoded = encrypt_string("secret text", password="my-password")
text = decrypt_string(encoded, password="my-password")
File Encryption
Files under 64KB use a single encrypted blob. Larger files use chunked encryption for memory efficiency.
from cryptoserve_core import encrypt_file, decrypt_file
encrypt_file("report.pdf", "report.pdf.enc", password="file-password")
decrypt_file("report.pdf.enc", "report.pdf", password="file-password")
Password Hashing
Secure password hashing with scrypt or PBKDF2. Output follows the PHC (Password Hashing Competition) string format for safe database storage.
from cryptoserve_core import hash_password, verify_password, check_strength
# Hash (default: scrypt)
hashed = hash_password("user-password")
# Output: $scrypt$n=16384,r=8,p=1$<salt>$<hash>
# Hash with PBKDF2
hashed = hash_password("user-password", algorithm="pbkdf2")
# Output: $pbkdf2-sha256$i=600000$<salt>$<hash>
# Verify (constant-time comparison)
assert verify_password("user-password", hashed)
# Strength check (0-4 score)
result = check_strength("P@ssw0rd!2026")
print(f"Score: {result.score}/4 ({result.label})")
print(f"Feedback: {result.feedback}")
JWT Tokens
Minimal JWT implementation using HS256 (HMAC-SHA256). No pyjwt dependency.
from cryptoserve_core import create_token, verify_token, decode_token
key = b"my-secret-key-minimum-16-bytes"
# Create with automatic iat/exp claims
token = create_token({"sub": "user-123", "role": "admin"}, key=key, expires_in=3600)
# Verify signature and expiry
claims = verify_token(token, key=key)
# Decode without verification (inspect claims)
claims = decode_token(token)
Low-Level API
For custom key management and direct cipher access:
from cryptoserve_core import AESGCMCipher, ChaCha20Cipher, KeyDerivation
# Generate a key
key = KeyDerivation.generate_key(256)
# AES-256-GCM encryption
cipher = AESGCMCipher(key)
ciphertext, nonce = cipher.encrypt(b"sensitive data")
plaintext = cipher.decrypt(ciphertext, nonce)
# ChaCha20-Poly1305 encryption
cipher = ChaCha20Cipher(key)
ciphertext, nonce = cipher.encrypt(b"sensitive data")
plaintext = cipher.decrypt(ciphertext, nonce)
# Key derivation from password
key, salt = KeyDerivation.from_password("my-password", bits=256, iterations=600_000)
Supported Algorithms
| Algorithm | Security | Use Case |
|---|---|---|
| AES-256-GCM | 256-bit | General purpose, hardware accelerated |
| ChaCha20-Poly1305 | 256-bit | Mobile, real-time applications |
| scrypt | N=16384, r=8, p=1 | Password hashing (interactive) |
| PBKDF2-SHA256 | 600K iterations | Password hashing (compatibility) |
| HS256 | HMAC-SHA256 | JWT token signing |
Why cryptoserve-core?
- Zero config - Production-safe defaults for every algorithm
- No server required - Works entirely offline
- One dependency - Only
cryptography(no pyjwt, bcrypt, argon2-cffi) - Auditable - Small, focused codebase with continuous security validation
- Standards compliant - NIST-approved algorithms, PHC hash format
License
Apache 2.0
Metadata
Release files for cryptoserve-core 0.4.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cryptoserve_core-0.4.2.tar.gz | 17.9 kB | Without provenance | Details for cryptoserve_core-0.4.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cryptoserve_core-0.4.2-py3-none-any.whl | Python 3 | none | any | Details for cryptoserve_core-0.4.2-py3-none-any.whl |
Total release size: 36.9 kB
Release files / cryptoserve_core-0.4.2.tar.gz
| Download URL | cryptoserve_core-0.4.2.tar.gz |
|---|---|
| Size | 17.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee981eb17d98325a9db91a03d13f30f85a463f2164ffcc22880de44554236a97
|
|
BLAKE2b-256 checksum How to use checksums |
50a6900b126c2e098e694e9be7b58c6ced377d68efa54435b49df0947aa923f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Release files / cryptoserve_core-0.4.2-py3-none-any.whl
| Download URL | cryptoserve_core-0.4.2-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f874622b14bb70113b7c36125d02d8c2fff5a8a2272bd7baf5f95f72b8a6489e
|
|
BLAKE2b-256 checksum How to use checksums |
46bf220fe21c20fd438cf683c2d84005fbdea3ef58d7d7032dfc330121a85b93
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.3
|
Security for cryptoserve-core 0.4.2
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.