如何进行与上的结果匹配的基本 sha256 加密(描述中的网站)

How to do a basic sha256 encryption that matches the results on (website in description)

我正在设置一个登录验证函数来将用户输入的密码与存储在数据库中的密码进行比较。数据库密码是 sha256,然后在前面添加盐,然后再次添加 sha256。

这就是我目前正在做的事情,但它显然做了一些额外的事情,所以我没有得到基本的 sha256,例如这个网站提供的 https://emn178.github.io/online-tools/sha256.html

from passlib.hash import sha256_crypt
passwordCandidate = "test"
passwordCandidate = sha256_crypt.encrypt(passwordCandidate)
print(passwordCandidate, file=sys.stderr)

我想得到的是: 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08

我得到的是: $rounds=535000$VZ4p1Kf9FmCL9Czc$.zvnilwPGcHhL54nq13LLrSxi0BXvSl0vW5C0zy5ya/

这适用于 hashlib

import hashlib

passwordCandidate = "test"
print(hashlib.sha256(passwordCandidate.encode()).hexdigest())

# print : 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08