Symmetric encryption helper (Fernet) for Volkanos Django modules
Project description
django-crypt
Symmetric encryption helper (Fernet) for Volkanos Django modules. Wraps cryptography.fernet
with a salt loaded from settings.CRYPT_SALT.
Quick Start
Requires Python 3.11+.
make install # uv venv + install deps
make test # run tests
make lint # ruff check + format
Usage
from django_crypt import Crypt
# Encrypt / decrypt
crypt = Crypt() # uses settings.CRYPT_SALT
encrypted = crypt.encrypt("secret value")
decrypted = crypt.decrypt(encrypted)
assert decrypted == "secret value"
# Generate fresh salt (for first-time setup)
salt = Crypt.generate_salt() # static method
print(f"Save this in settings.CRYPT_SALT: {salt}")
Management Commands
python manage.py generate_salt # generate fresh salt
python manage.py encrypt "plain text" # encrypt a string
python manage.py decrypt "<ciphertext>" # decrypt a string
Settings
# In Django settings.py
CRYPT_SALT = "<output of generate_salt>"
INSTALLED_APPS = [..., "django_crypt"]
Important
Fernet ciphertexts are non-deterministic — encrypting the same plaintext twice yields
different ciphertexts. For deterministic lookup hashing (e.g. unique-indexed code lookup),
use a separate HMAC-SHA256 helper, not Crypt.encrypt().
Details
See AGENTS.md for architecture and integration details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file entirius_django_crypt-2.0.0.tar.gz.
File metadata
- Download URL: entirius_django_crypt-2.0.0.tar.gz
- Upload date:
- Size: 39.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c4ae51c3f08b68d8f5562d7919c6a2f4c8f8671c478136e7501c127bd2bbf58
|
|
| MD5 |
fd653633c66785dc9cf0d930fc9572d7
|
|
| BLAKE2b-256 |
7b68394c3aff094a3e907101812c74b226a27a67ef7335f6111757bc59f43315
|
File details
Details for the file entirius_django_crypt-2.0.0-py3-none-any.whl.
File metadata
- Download URL: entirius_django_crypt-2.0.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f31cf81856792cff53154ff8f5eb5e406716741298fdb4da41935250f766ab3
|
|
| MD5 |
77f1e140f8523ab092f9dcd7b9d3a95c
|
|
| BLAKE2b-256 |
3bda9e40e82f51d962bc9ea90dcd7ede3378e121ea5b3978085494204658d791
|