← Back to challenges

Check Password Hash

PythonHardcryptographyarraysconditionsvalidation

Instructions

Write a function that takes a username and password and checks the list user_pass_db for a match. The list stores the passwords as a hash using the SHA1 algorithm. Return True for a match and False otherwise.

Examples

user_pass_db = [{"username" : "myUsername", "pass_hash" : "5413ee24723bba2c5a6ba2d0196c78b3ee4628d1"}]

check_pass("myUsername", "myPassword") ➞ True

check_pass("myUsername", "wrongPassword") ➞ False

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.