fork(1) download
  1. #!/usr/bin/python3
  2. from passlib.hash import pbkdf2_sha256
  3.  
  4. def hash(string) :
  5. return pbkdf2_sha256.encrypt(string,
  6. rounds=200000,
  7. salt_size=16)
  8.  
  9. def verify(input, stored_hash) :
  10. return pbkdf2_sha256.verify(input, stored_hash)
  11.  
  12. stored_hash = hash("pass")
  13. print(stored_hash)
  14. user_pass = input("Enter your password: ")
  15. if verify(user_pass,stored_hash) :
  16. print("Welcome!")
  17. else :
  18. print("wrong password!")
Runtime error #stdin #stdout #stderr 0.03s 9984KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 2, in <module>
ImportError: No module named 'passlib'