Last active
October 18, 2023 17:39
-
-
Save c-neto/a1ddca4e148aa36651e9ec63488668fa to your computer and use it in GitHub Desktop.
Generate hash SHA-512 with salt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires: pip install passlib | |
from passlib import hash | |
x = hash.sha512_crypt.hash("carlos", salt="neto", rounds=5000) | |
y = hash.sha512_crypt.hash("carlos", salt="xxx", rounds=5000) | |
print(hash.sha512_crypt.verify("carlos", x)) | |
# >>> true | |
print(hash.sha512_crypt.verify("carlos", y)) | |
# >>> true | |
print(hash.sha512_crypt.verify("liks", x)) | |
# >>> false | |
print(hash.sha512_crypt.verify("liks", y)) | |
# >>> false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment