所以我将密码和用户名存储在单独的文件中,我想解密它们并检查它们,但是每当我解密单词时,它都会在原始单词中添加字符:
def checkLogin(usernameInput, passwordInput, key, Usr):
f = Fernet(key)
with open("username.csv", "rb") as file:
encryptedUsername = file.read()
decryptedUsername = f.decrypt(encryptedUsername)
with open("password.csv", "rb") as file:
encryptedPassword = file.read()
decryptedPassword = f.decrypt(encryptedPassword)
print(decryptedPassword)
print(decryptedUsername)
usernameInput = usernameInput.get()
passwordInput = passwordInput.get()
当我打印它返回的解密字符串时,原始用户名和密码是:“Admin”和“SecurePassword”:“b'SecurePassword\r\n'”和“b'Admin'”