Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |