xxxxxxxxxx
from passlib.hash import sha256_crypt
password = sha256_crypt.encrypt("password")
password2 = sha256_crypt.encrypt("password")
print(password)
print(password2)
print(sha256_crypt.verify("password", password))
xxxxxxxxxx
import hashlib
password = "mysecretpassword"
# Create a SHA-256 hash object
hash_object = hashlib.sha256()
# Convert the password to bytes and hash it
hash_object.update(password.encode())
# Get the hex digest of the hash
hash_password = hash_object.hexdigest()
print(hash_password)