Flask-Hashing is a Flask extension that provides an easy way to
hash data and check a hash of a value against a given hash.
hashlib to actually hash data.
This extension prevents the user from needing to worry about how to hash data. Instead, developers are provided a simple call to do any necessary hashing of data.
This extension is intended to be used in place of Flask-Bcrypt,
if the user so desires. Not everyone may want to use
for their hashing needs, and this provides a way to handle that
$ pip install flask-hashing
or if you don't have
$ easy_install flask-hashing
from flask import Flask from flask.ext.hashing import Hashing app = Flask(__name__) hashing = Hashing(app)
After creating an instance of
Hashing, we can hash data and
check hashes of data as follows:
h = hashing.hash_value('secretdata', salt='abcd') if hashing.check_value(h, 'secretdata', salt='abcd'): # do some stuff because the hashes are equal
$ python setup.py test
$ python test_hashing.py
sphinx then in the
docs directory run
You can see a live copy of the docs at Read the Docs.