slim_cli/template/model/user.py
def gen_password_and_salt(cls, password_text):
        """ 生成加密后的密码和盐 """
        salt = os.urandom(32)
        dk = hashlib.pbkdf2_hmac(
            config.PASSWORD_HASH_FUNC_NAME,
            password_text.encode('utf-8'),
            salt,
            config.PASSWORD_HASH_ITERATIONS,
        )
        return {'password': dk, 'salt': salt}
def gen_password_and_salt(cls, password_text):
        """ 生成加密后的密码和盐 """
        salt = os.urandom(32)
        dk = hashlib.pbkdf2_hmac(
            config.PASSWORD_HASH_FUNC_NAME,
            password_text.encode('utf-8'),
            salt,
            config.PASSWORD_HASH_ITERATIONS,
        )
        return {'password': dk, 'salt': salt}
def gen_password_and_salt ( cls , password_text ) : salt = os . urandom ( 32 ) dk = hashlib . pbkdf2_hmac ( config . PASSWORD_HASH_FUNC_NAME , password_text . encode ( 'utf-8' ) , salt , config . PASSWORD_HASH_ITERATIONS , ) return { 'password' : dk , 'salt' : salt }
生成加密后的密码和盐
生成加密后的密码和盐