Check Password Hash

Published by Mubashir Hassan in

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

Examples

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

checkPass("myUsername", "myPassword") ➞ true

checkPass("myUsername", "wrongPassword") ➞ false

Notes

N/A

Watch a quick demo on how Edabit works.