Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/firebase/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Firebase身份验证:导入sctipt以导入使用自定义哈希生成器哈希的密码_Firebase_Firebase Authentication - Fatal编程技术网

Firebase身份验证:导入sctipt以导入使用自定义哈希生成器哈希的密码

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

有没有办法设置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 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')