Commit 9a5fe02f authored by kranthi.kumar's avatar kranthi.kumar

Update utility.py

parent 2f6951ee
import logging
import bcrypt
from pymongo import MongoClient
......@@ -34,3 +35,16 @@ class Mongo_utility:
return details
except Exception:
logging.exception("Exception occurred", exc_info=True)
# method for hashing
@staticmethod
def hashing(password, value):
try:
# hashing the password
if value is not None:
return bcrypt.hashpw(password.encode('utf8'), bcrypt.gensalt())
else:
# validating password
return bcrypt.checkpw(password.encode('utf8'), value)
except Exception:
logging.exception("Exception occurred", exc_info=True)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment