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.
Metadata
Release files for entirius-django-crypt 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| entirius_django_crypt-2.0.0.tar.gz | 39.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| entirius_django_crypt-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 50.9 kB
Release files / entirius_django_crypt-2.0.0.tar.gz
| Download URL | entirius_django_crypt-2.0.0.tar.gz |
|---|---|
| Size | 39.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c4ae51c3f08b68d8f5562d7919c6a2f4c8f8671c478136e7501c127bd2bbf58
|
|
BLAKE2b-256 checksum How to use checksums |
7b68394c3aff094a3e907101812c74b226a27a67ef7335f6111757bc59f43315
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|
Release files / entirius_django_crypt-2.0.0-py3-none-any.whl
| Download URL | entirius_django_crypt-2.0.0-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1f31cf81856792cff53154ff8f5eb5e406716741298fdb4da41935250f766ab3
|
|
BLAKE2b-256 checksum How to use checksums |
3bda9e40e82f51d962bc9ea90dcd7ede3378e121ea5b3978085494204658d791
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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}
|