Skip to content

Commit

Permalink
Added passlib and utility functions
Browse files Browse the repository at this point in the history
  • Loading branch information
qtsathish committed Nov 28, 2021
1 parent 0c03b3b commit 7439ca3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Binary file modified InstaCook/requirements.txt
Binary file not shown.
20 changes: 20 additions & 0 deletions InstaCook/utils.py
@@ -0,0 +1,20 @@
from passlib.hash import pbkdf2_sha256


def hash_password(password):
"""
This method returns sha256 hash of the password entered
:param password: password in plain text
:return: sha-256 hash of the password
"""
return pbkdf2_sha256.hash(password)


def check_password(password, hashed):
"""
This method will return true if the password hashes match
:param password: password
:param hashed: hashed password from database
:return: True if the match False otherwise
"""
return pbkdf2_sha256.verify(password, hashed)

0 comments on commit 7439ca3

Please sign in to comment.