From 535d165f0483547e52364cfb21ac232d6c120f1a Mon Sep 17 00:00:00 2001 From: Igor Magalhaes Date: Sun, 10 Dec 2023 21:18:35 -0300 Subject: [PATCH] SocialPulse: passlib replaced with bcrypt for password hashing If passlib isn't replaced, hashing will not work when python is updated to 3.13 Co-authored-by: resist15 Change-Id: Idd1b0bdbc8d8c7224ad9e1ac84a3b4491bbcd88c --- app/utils.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/app/utils.py b/app/utils.py index d66e11e..9029b49 100644 --- a/app/utils.py +++ b/app/utils.py @@ -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())