Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.49 KB | None | 0 0
  1.       def _encrypt_password(self, raw_password):
  2.           if isinstance(raw_password, unicode):
  3.               raw_password = raw_password.encode('UTF-8')
  4.           salt = sha1(os.urandom(60)).hexdigest()[:SALT_LENGTH]
  5.           hash = sha1(raw_password + salt).hexdigest()
  6.           salted_hash = salt + hash
  7.           return salted_hash
  8.  
  9.       def validate_password(self, raw_password):
  10.           salt = self.password[:SALT_LENGTH]
  11.           hash = sha1(raw_password + salt).hexdigest()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement