Skip to content

Instantly share code, notes, and snippets.

@foxcarlos
Created September 30, 2019 00:35
Show Gist options
  • Save foxcarlos/cf7954a450ae65b76ecebbd0811b2223 to your computer and use it in GitHub Desktop.
Save foxcarlos/cf7954a450ae65b76ecebbd0811b2223 to your computer and use it in GitHub Desktop.
Passlib ejemplo
>>> # import the hash algorithm
>>> from passlib.hash import pbkdf2_sha256
>>> # generate new salt, and hash a password
>>> hash = pbkdf2_sha256.hash("toomanysecrets")
>>> hash
'$pbkdf2-sha256$29000$N2YMIWQsBWBMae09x1jrPQ$1t8iyB2A.WF/Z5JZv.lfCIhXXN33N23OSgQYThBYRfk'
>>> # verifying the password
>>> pbkdf2_sha256.verify("toomanysecrets", hash)
True
>>> pbkdf2_sha256.verify("joshua", hash)
False
# https://passlib.readthedocs.io/en/stable/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment