Created
December 22, 2020 23:05
-
-
Save K-Mistele/94cd937d524190996f60ef6d5b7ca6ea to your computer and use it in GitHub Desktop.
Python pseudo-code for password hashing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def login(username, password): | |
| user = Users.get(username) # fetch the user record from the database | |
| # if no user matches the username, don't log them in | |
| if not user: | |
| return False | |
| # hash the supplied password | |
| supplied_hash = some_hash_function(password) | |
| # see if that hash matches the user's hash | |
| if supplied_hash == user.password_hash: | |
| return True | |
| else: | |
| return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment