Skip to content

Commit

Permalink
SocialPulse: passlib replaced with bcrypt for password hashing
Browse files Browse the repository at this point in the history
If passlib isn't replaced, hashing will not work when python is updated to 3.13

Co-authored-by: resist15 <sourav@aospa.co>
Change-Id: Idd1b0bdbc8d8c7224ad9e1ac84a3b4491bbcd88c
  • Loading branch information
igorbenav and resist15 committed Aug 12, 2024
1 parent 782ccd7 commit 535d165
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions app/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from passlib.context import CryptContext

pwd_context = CryptContext(schemes=["bcrypt"],deprecated="auto")
import bcrypt

def hash(password: str):
return pwd_context.hash(password)
return bcrypt.hashpw(password.encode(), bcrypt.gensalt()).decode()

def verify(plain_pass, hashed_pass):
return pwd_context.verify(plain_pass,hashed_pass)
return bcrypt.checkpw(plain_pass.encode(), hashed_pass.encode())

0 comments on commit 535d165

Please sign in to comment.