Python 如何加载已加密以供使用的数据?

Python 如何加载已加密以供使用的数据?,python,encryption,Python,Encryption,我对标题不是很在行,所以让我在这里把它分解一下 我正在使用python为我正在开发的游戏创建一个非常基本的加密登录/创建帐户功能,但我一直遇到缓冲区错误,我无法让python解密存储在dict中的数据 我试过几种方法来验证密码 json pickle file = open encrypting the password and comparing it with to password on the file decrying the files password and comparing

我对标题不是很在行,所以让我在这里把它分解一下

我正在使用python为我正在开发的游戏创建一个非常基本的加密登录/创建帐户功能,但我一直遇到
缓冲区错误
,我无法让python解密存储在dict中的数据 我试过几种方法来验证密码

json
pickle
file = open
encrypting the password and comparing it with to password on the file
decrying the files password and comparing it with and input
comparing the encrypted data to the encrypted data
我已经为此挣扎了一周,我已经在replit.com上多次询问过这个问题,但似乎没有人能帮我

这是我的密码

def login():
  while True:
    print('enter your username')

    username = input()
    print('enter password')
    password = input().encode()

    try:
      with open(username, 'rb') as userdata:
        user = pl(userdata)

        f = c(user['key'])

        password = f.encrypt(password)
        if password == user['password']:
          print(user)
        
        else:
          print(user['password'],'\n')
          print(password)
    except FileNotFoundError:
      print('invalid username or password')

请把你的问题说清楚。您尚未显示任何错误或定义特定问题。您可以参考询问指南你好,您的问题是如何解密数据?是的,你能告诉我怎么加密吗?