Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def _encrypt_password(self, raw_password):
- if isinstance(raw_password, unicode):
- raw_password = raw_password.encode('UTF-8')
- salt = sha1(os.urandom(60)).hexdigest()[:SALT_LENGTH]
- hash = sha1(raw_password + salt).hexdigest()
- salted_hash = salt + hash
- return salted_hash
- def validate_password(self, raw_password):
- salt = self.password[:SALT_LENGTH]
- hash = sha1(raw_password + salt).hexdigest()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement