passlib



examples/flask/use_passlib.py
from passlib.hash import pbkdf2_sha256
import sys

if len(sys.argv) != 2:
   exit("Usage: {} PASSWORD".format(sys.argv[0]))

pw = sys.argv[1]

hash1 = pbkdf2_sha256.hash(pw)
print(hash1)

hash2 = pbkdf2_sha256.hash(pw)
print(hash2)

print(pbkdf2_sha256.verify(pw, hash1))
print(pbkdf2_sha256.verify(pw, hash2))

$ python use_passlib.py "my secret"
$pbkdf2-sha256$29000$svZ.7z2HEEJIiVHqPeecMw$QAWd8P7MaPDXlEwtsv9AqhFEP2hp8MvZ9QxasIw4Pgw
$pbkdf2-sha256$29000$XQuh9N57r9W69x6jtDaG0A$VtD35zfeZhXsE/jxGl6wB7Mjwj/5iDGZv6QC7XBJjrI
True
True