This commit is contained in:
@@ -11,6 +11,7 @@ from Crypto.Hash import SHA256
|
||||
from Crypto.Protocol.KDF import bcrypt, bcrypt_check
|
||||
from Crypto.PublicKey import RSA
|
||||
from Crypto.PublicKey.RSA import RsaKey
|
||||
from Crypto.Random import get_random_bytes
|
||||
|
||||
auth_logger = logging.getLogger('AUTH APPLICATION ')
|
||||
auth_logger.setLevel(logging.INFO)
|
||||
@@ -82,9 +83,10 @@ class Authetication:
|
||||
|
||||
|
||||
def saveUser(self, username: str, password: str) -> bool:
|
||||
user_salt = get_random_bytes(16)
|
||||
bytePass = password.encode('utf-8')
|
||||
b64pwd = b64encode(SHA256.new(bytePass).digest())
|
||||
bcrypt_hash = bcrypt(b64pwd, 12)
|
||||
bcrypt_hash = bcrypt(password=b64pwd, cost=12, salt=user_salt)
|
||||
|
||||
with open(self.CONFIG_FILE_LOCATION) as json_file:
|
||||
data = json.load(json_file)
|
||||
|
||||
Reference in New Issue
Block a user