Firebase身份验证:导入sctipt以导入使用自定义哈希生成器哈希的密码
有没有办法设置Firebase auth:import以使其与下面的哈希生成器一起工作 生成哈希和salt的Python代码:Firebase身份验证:导入sctipt以导入使用自定义哈希生成器哈希的密码,firebase,firebase-authentication,Firebase,Firebase Authentication,有没有办法设置Firebase auth:import以使其与下面的哈希生成器一起工作 生成哈希和salt的Python代码: def generate_password(self, pw): """generate password hash""" if isinstance(pw, tornado.util.unicode_type): pw = pw.encode('utf-8') if
def generate_password(self, pw):
"""generate password hash"""
if isinstance(pw, tornado.util.unicode_type):
pw = pw.encode('utf-8')
if not self.salt:
chars = [random.choice(string.printable) for x in range(32)]
self.salt = ''.join(chars)
pw = sha256(pw).hexdigest()
ret = sha256((pw + self.salt).encode('utf-8')).hexdigest().encode('utf-8')
for i in range(1328):
ret = sha256(ret).hexdigest().encode('utf-8')
return ret.decode('utf-8')