Skip to content

Instantly share code, notes, and snippets.

@K-Mistele
Created December 22, 2020 23:05
Show Gist options
  • Select an option

  • Save K-Mistele/94cd937d524190996f60ef6d5b7ca6ea to your computer and use it in GitHub Desktop.

Select an option

Save K-Mistele/94cd937d524190996f60ef6d5b7ca6ea to your computer and use it in GitHub Desktop.
Python pseudo-code for password hashing
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