Skip to content

Instantly share code, notes, and snippets.

@brutasse
Created November 29, 2012 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brutasse/4168160 to your computer and use it in GitHub Desktop.
Save brutasse/4168160 to your computer and use it in GitHub Desktop.
from django.contrib.auth.hashers import BasePasswordHasher
class NotHashingHasher(BasePasswordHasher):
"""
A hasher that does not hash.
"""
algorithm = 'plain'
def encode(self, password, salt):
return '{0}${1}'.format(self.algorithm, password)
def salt(self):
return None
def verify(self, password, encoded):
algo, decoded = encoded.split('$', 1)
return password == decoded
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment