backend = default_backend()
salt = b'2444'
kdf = PBKDF2HMAC(
algorithm=hashes.SHA256(),
length=32,
salt=salt,
iterations=100000,
backend=backend
)
This is the kdf setup.
def getMasterPassword():
checkHashedPassword = hashPassword(txt.get().encode('utf-8'))
global encryptionKey
encryptionKey = base64.urlsafe_b64encode(kdf.derive(txt.get().encode()))
cursor.execute('SELECT * FROM masterpassword WHERE id = 1 AND password = ?', [(checkHashedPassword)])
return cursor.fetchall()
def checkPassword():
password = getMasterPassword()
if password:
vaultScreen()
else:
txt.delete(0, 'end')
This is my hash algorithm
in derive
raise AlreadyFinalized("PBKDF2 instances can only be used once.")
cryptography.exceptions.AlreadyFinalized: PBKDF2 instances can only be used once.
This is the error I am getting when input a wrong password and then try to re-enter it.
Libraries used: