def create_account(cls, name, account, password, avatar=None, email=None): n = cls() n.name = name n.account = account n.password = bcrypt.hashpw(password, bcrypt.gensalt()) n.avatar = avatar if email: n.email = email n.put() return n
def hash(cls, password): return bcrypt.hashpw(password, bcrypt.gensalt())
def make_pw_hash(name, password): hashed = bcrypt.hashpw(name + password, bcrypt.gensalt()) return hashed
def hash_pwd(self, pwd): self.pwd = bcrypt.hashpw(pwd, bcrypt.gensalt(1))
def make_bcrypt_hash(password): ''' checks the authenticity of the submitted password against a hash ''' return bcrypt.hashpw(password, bcrypt.gensalt(2))
def make_pw_hash(name, pw, salt = bcrypt.gensalt(5)): h = bcrypt.hashpw(str(name + pw + salt), salt) return '%s|%s' % (salt, h)
def secure_cookie(cookie_val,n_salt=2): try: bcr_hash= bcrypt.hashpw(cookie_val, bcrypt.gensalt(n_salt)).split('$')[-1]+ '.'+cookie_val return bcr_hash except: return None
def secure_pw(pw,n_salt=2): try: return bcrypt.hashpw(pw, bcrypt.gensalt(n_salt)).split('$')[-1] except: return None
def secure_pw(pw, n_salt=1): return bcrypt.hashpw(pw, bcrypt.gensalt(n_salt)).split('$')[-1]
def hash_password(password): return bcrypt.hashpw(password, bcrypt.gensalt())
def bycrypt_password(self): self.password = u'' + bcrypt.hashpw(u'' + self.password, bcrypt.gensalt()) self.put()
def bycrypt_password_with_old_password(self): if self.old_password != self.new_password: self.password = u'' + bcrypt.hashpw(u'' + self.new_password, bcrypt.gensalt()) self.put()
def hashText(text, iters = 2): '''Returns a hexhash of the text using bcrypt for n iterations''' # I don't actually know how reliable python bcrypt is # But compiled version is not an option with GAE return bcrypt.hashpw(text, bcrypt.gensalt(iters)).encode('hex')
def encrpytPassword(self,password): return hashpw(password, gensalt());