https://github.com/fmorgner/django_cryptofield
Database backed, crypto fields for django
https://github.com/fmorgner/django_cryptofield
Last synced: 4 months ago
JSON representation
Database backed, crypto fields for django
- Host: GitHub
- URL: https://github.com/fmorgner/django_cryptofield
- Owner: fmorgner
- Created: 2016-07-02T15:53:11.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-07-03T12:15:28.000Z (almost 10 years ago)
- Last Synced: 2025-04-12T04:39:16.738Z (about 1 year ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
Crypto-fields for Django
========================
This package provides database backed, encrypted fields for Django. The fields use database internal mechanisms to encrypt and verify strings completely inside the database. This functionality is interesting for use with passwords that are stored in a database as it allows the database to manage salting, hashing, and verification of the passwords.
Support notes
~~~~~~~~~~~~~
Currently only PostgreSQL is supported as a database backend. I would be happy if someone with experience in MySQL or other databases that support encryption would provide hints or implementations for their favourite database.
Usage
-----
Using ``cryptofield`` is easy::
from django.db import models
import cryptofield
class ModelWithCrypto(models.Model):
password = cryptofield.CryptoField()
Keyword arguments
~~~~~~~~~~~~~~~~~
The ``CryptoField`` class supports the following keyword arguments:
========= ============================ ============================
Keyword Description Values
--------- ---------------------------- ----------------------------
algorithm The hashing algorithm to use bf (default), md5, xdes, des
========= ============================ ============================
Requirements (PostgreSQL)
-------------------------
To use this package with PostgreSQL, make sure that the database in use has the ``pgcrypto`` extension activated. To do so, issue the following command to the desired database::
CREATE EXTENSION IF NOT EXISTS pgcrypto;
If no error occurs, the ``CryptoField`` class can now be used with the database.